Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- em = ConnectionHib.emf.createEntityManager();
- em.getTransaction().begin();
- Recibo recibo = new Recibo();
- Log log = new Log();
- em.createQuery("UPDATE Numeracao s SET s.fcNoRecibo = s.fcNoRecibo+1 WHERE s.emp= :emp ")
- .setParameter("emp", emp.getCodigo())
- .executeUpdate();
- recibo.setNoRecibo(noRecibo);
- log.setnorecibo(noRecibo);
- em.persist(recibo);
- em.persist(log);
- em.getTransaction().commit();
- }
- catch (Exception e)
- {
- em.getTransaction().rollback();
- throw e;
- }
- finally
- {
- em.close();
- }
Add Comment
Please, Sign In to add comment