I'm able to call entityManager.merge(obj)
, but not entityManager.flush()
.
I am getting "no transaction in progress".
My application context has:
<jee:jndi-lookup jndi-name="${persistenceEMFJndiServerName}"
id="entityManagerFactory" expected-type="javax.persistence.EntityManagerFactory" />
<bean id="entityManager"
class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" >
</bean>
My persistence unit says transaction-type="JTA"
and I'm loading it via
@PersistenceContext
private EntityManager entityManager;
I've tried a few things, like entityManager.joinTransaction(), entityManager.getTransaction().begin()/.end(), @Resource UserTransaction with BEAN transaction management, but it says I cant, with JTA. There's just no transaction going on.
My method has
@Transactional
@TransactionAttribute(TransactionAttributeType.REQUIRED)
and it's an EJB, so I'm getting pretty annoyed. CMT JTA is supposed to do transactions all by itself.
Aucun commentaire:
Enregistrer un commentaire