Skip to content

EclipseLink marks transaction RollbackOnly when applying timeout for "nonread" queries [SPR-10068] #14701

@spring-projects-issues

Description

@spring-projects-issues

Igor Mihalik opened SPR-10068 and commented

Transaction "RollbackOnly" problem occurs when using EclipseLink (any version up to 2.5.0-M5) together with Spring ORM and "timeout" attribute on @Transactional in case of "delete" query.

EntityManagerFactoryUtil class in method "applyTransactionTimeout" sets a hint "javax.persistence.lock.timeout". However EclipseLink throws back an exception:
java.lang.IllegalArgumentException: Query delete from [*], query hint javax.persistence.lock.timeout is not valid for this type of query.

Moreover EclipseLink sets RollbackOnly on current transaction and doCommit throws: Exception in thread "main" org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction rolled back because transaction was set to RollbackOnly.

Attached is a simple project to demonstrate the problem.


Affects: 3.1.3

Attachments:

Backported to: 3.1.4

Metadata

Metadata

Assignees

Labels

status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions