When using EntityManager with no transaction, Hibernate will setRollbackOnly even if there is not an active transaction, causing transaction manager to generate erroneous no transaction messages:
{code} 2018-05-14 WARN [main]: This method needs a transaction for the calling thread and none exists. Possible causes: either you didn't start a transaction, it rolledback due to timeout, or it was committed already. ACTIONS: You can try one of the following: 1. Make sure you started a transaction for the thread. 2. Make sure you didn't terminate it yet. 3. Increase the transaction timeout to avoid automatic rollback of long transactions; check http://www.atomikos.com/Documentation/JtaProperties for how to do this. [logger=com.atomikos.icatch.jta.TransactionManagerImp, mdc={}] {code}
For example: [SpringBoot - Atomikos - Warning of missing transaction in latest 2.0.x snapshot #9673|https://github.com/spring-projects/spring-boot/issues/9673]
The {{TransactionImpl.setRollbackOnly}} appears to be violating the {{javax.persistence.EntityTransaction}} contract from the spec by allowing {{setRollbackOnly}} to be called when there is no *active* transaction.
{code:java} /** * Mark the current resource transaction so that the only * possible outcome of the transaction is for the transaction * to be rolled back. * @throws IllegalStateException if isActive() is false */ public void setRollbackOnly(); {code} My interpretation of this is that setRollbackOnly should not be called when there is no active transaction and that if setRollbackOnly should throw ISE if it is called when there no active transaction. |
|