Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Dec 3, 2012 · 1 comment
Assignees
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Fixed through simply not setting "javax.persistence.lock.timeout" at all anymore, relying on "javax.persistence.query.timeout" to be sufficient for Spring's purposes of enforcing a timeout for the entire transaction.

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2 GA milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants