daily pastebin goal
89%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ManyToMany  
  2. @JoinTable(name = "academico.tab_cudi",joinColumns = {
  3.    @JoinColumn(name = "coddisc")},inverseJoinColumns = {
  4.    @JoinColumn(name = "codcurs")
  5. })
  6. private List<TabCurs> codigo;
  7.    
  8. @ManyToMany(
  9.     cascade = {CascadeType.PERSIST, CascadeType.MERGE},
  10.     mappedBy = "codigo"
  11. )
  12. private List<TabDisc> codigo;
  13.    
  14. @Override
  15. public void Salvar(TabDisc b) {
  16.     try{
  17.         Session s = HibernateUtil.getSession();
  18.         new CrudUtil<TabDisc>(b, CrudUtil.tipo.INSERT, s);
  19.     }catch(Exception ex){
  20.         ex.printStackTrace();
  21.     }
  22. }
  23.  
  24. public void execulte() {
  25.     Transaction t = s.getTransaction();
  26.     try {
  27.         switch (op) {
  28.             case INSERT:
  29.                 s.saveOrUpdate(obj);
  30.                 break;
  31.             case UPDATE:
  32.                 s.update(obj);
  33.                 break;
  34.             case DELETE:
  35.                 s.delete(obj);
  36.                 break;
  37.         }
  38.         t.commit();
  39.  
  40.         s.close();
  41.     } catch (Exception e) {
  42.         t.rollback();
  43.         s.clear();
  44.         s.cancelQuery();
  45.         s.close();
  46.         throw e;
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top