@Override public void teardown(final Map<String, Object> properties) { NonTxEmCloser.popCall(); // close any transactional entity managers that were created without a jta transaction. }
@Override public void setup(final Map<String, Object> properties) { NonTxEmCloser.pushCall(); // create a thread local place to hold created transactional entity managers }
@Override protected EntityManager getEntityManager() { EntityManager entityManager; boolean isInTx; isInTx = TransactionUtil.isInTx(transactionManager); if (isInTx) { entityManager = getOrCreateTransactionScopedEntityManager(emf, puScopedName, properties, synchronizationType); } else { entityManager = NonTxEmCloser.get(puScopedName); if (entityManager == null) { entityManager = createEntityManager(emf, properties, synchronizationType); NonTxEmCloser.add(puScopedName, entityManager); } } return entityManager; }
@Override protected EntityManager getEntityManager() { EntityManager entityManager; boolean isInTx; isInTx = TransactionUtil.isInTx(transactionManager); if (isInTx) { entityManager = getOrCreateTransactionScopedEntityManager(emf, puScopedName, properties, synchronizationType); } else { entityManager = NonTxEmCloser.get(puScopedName); if (entityManager == null) { entityManager = createEntityManager(emf, properties, synchronizationType); NonTxEmCloser.add(puScopedName, entityManager); } } return entityManager; }
@Override public void setup(final Map<String, Object> properties) { NonTxEmCloser.pushCall(); // create a thread local place to hold created transactional entity managers }
@Override public void teardown(final Map<String, Object> properties) { NonTxEmCloser.popCall(); // close any transactional entity managers that were created without a jta transaction. }