Guest User

Untitled

a guest
Jan 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. try
  2. {
  3.  
  4.  
  5. em = ConnectionHib.emf.createEntityManager();
  6.  
  7. em.getTransaction().begin();
  8. Recibo recibo = new Recibo();
  9. Log log = new Log();
  10.  
  11. em.createQuery("UPDATE Numeracao s SET s.fcNoRecibo = s.fcNoRecibo+1 WHERE s.emp= :emp ")
  12. .setParameter("emp", emp.getCodigo())
  13. .executeUpdate();
  14.  
  15. recibo.setNoRecibo(noRecibo);
  16. log.setnorecibo(noRecibo);
  17.  
  18. em.persist(recibo);
  19. em.persist(log);
  20.  
  21.  
  22. em.getTransaction().commit();
  23.  
  24. }
  25. catch (Exception e)
  26. {
  27.  
  28. em.getTransaction().rollback();
  29.  
  30. throw e;
  31. }
  32. finally
  33. {
  34. em.close();
  35. }
Add Comment
Please, Sign In to add comment