- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
public Object save(Object entity) {
final EntityManager em = getEntityManager();
try {
final EntityTransaction et = em.getTransaction();
try {
et.begin();
em.persist(entity);
et.commit();
} finally {
if (et != null && et.isActive()) {
entity = null;
et.rollback();
}
}
} finally {
if (em != null && em.isOpen()) {
em.close();
}
}
return entity;
}