| 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:
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:
For example: SpringBoot - Atomikos - Warning of missing transaction in latest 2.0.x snapshot #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.
/**
* 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();
|