| .. | .. |
|---|
| 58 | 58 | } |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | private void releaseEntityManager() { |
|---|
| 61 | | - if (em != null && em.isOpen()) { |
|---|
| 62 | | - LOG.debug("CLOSING EM: {}, trans: {}", em, em.isJoinedToTransaction()); |
|---|
| 63 | | - try { |
|---|
| 61 | + try { |
|---|
| 62 | + if (em != null && em.isOpen()) { |
|---|
| 63 | + LOG.debug("CLOSING EM: {}, trans: {}", em, em.isJoinedToTransaction()); |
|---|
| 64 | 64 | if (em.isJoinedToTransaction()) { |
|---|
| 65 | 65 | em.getTransaction().rollback(); |
|---|
| 66 | 66 | LOG.info("ROLLBACK"); |
|---|
| 67 | 67 | } |
|---|
| 68 | 68 | em.close(); |
|---|
| 69 | | - } catch (Exception ex) { |
|---|
| 70 | | - ex.printStackTrace(); |
|---|
| 71 | | - LOG.error("Error closing EM: {}, {}", em, ex); |
|---|
| 72 | 69 | } |
|---|
| 70 | + } catch (Exception ex) { |
|---|
| 71 | + ex.printStackTrace(); |
|---|
| 72 | + LOG.error("Error closing EM: {}, {}", em, ex); |
|---|
| 73 | 73 | } |
|---|
| 74 | 74 | } |
|---|
| 75 | 75 | } |
|---|