Hibernate marks as rollback even for no transaction requests

Description

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:

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.

My interpretation of this is that setRollbackOnly should not be called when there is no active transaction and that setRollbackOnly should throw an ISE if it is called when there no active transaction.

Environment

ext.springDataJpaVersion = "2.0.6.RELEASE"
ext.hibernateVersion = "5.2.17.Final"
ext.springVersion = "5.0.5.RELEASE"
ext.atomikosVersion = "4.0.6"
ext.h2databaseVersion = "1.4.197"

Assignee

Unassigned

Reporter

Nathan Niesen

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.0.9

Components

Affects versions

Priority

Major
Configure