joinTransaction() opens transaction? [message #1778919] |
Sun, 24 December 2017 03:24  |
Eclipse User |
|
|
|
Hello,
I have the following code running with eclipselink 2.7 on Tomee 7.0.2 (simplified):
ut.begin();
InitialContext context = new InitialContext();
EntityManagerFactory containerEmf = (EntityManagerFactory) context.lookup("java:comp/env/Cibet");
EntityManager entityManager = containerEmf.createEntityManager();
Resource res = new JpaResource();
entityManager.persist(res);
ut.commit();
try {
entityManager.joinTransaction();
} catch (TransactionRequiredException e) {
log.info("... but cannot join transaction: " + e.getMessage());
}
ut.begin();
I get this exception on the second ut.begin():
javax.transaction.NotSupportedException: Nested Transactions are not supported
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.begin(TransactionManagerImpl.java:157)
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.begin(TransactionManagerImpl.java:152)
when I remove the joinTransaction() it works. With Eclipselink 2.4.2 on JPA 2.0 it worked too. It seems to me a bug
|
|
|
|
|
Re: joinTransaction() opens transaction? [message #1787041 is a reply to message #1786821] |
Thu, 17 May 2018 10:54  |
Eclipse User |
|
|
|
You should show your setup, especially the persistence.xml and datasource to make this occur, and set logging to finest or all to show details on the SQL and transaction behaviour within EclipseLink. JPA EntityManager joinTransaction() method is required to throw TransactionRequiredException if it is called outside of at transaction, are you getting that in your log? If so, show the stack, but as mentioned, if there is a problem with your transaction behaviour in the container, the issue is likely within your container - EclipseLink does not start external transactions.
Edit: checking out the link at http://www.logitags.com/cibet/faq.html#a9 and it seems you've tracked down the issue to this being configured as resource local. If it is resolved, please update the bugs, otherwise update them with the logs and config required to reproduce.
[Updated on: Thu, 17 May 2018 11:04] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 2.75966 seconds