Skip to content
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

Rollback transactions in case if Exception was thrown #23789

Closed
raderio opened this issue Oct 13, 2019 · 2 comments
Closed

Rollback transactions in case if Exception was thrown #23789

raderio opened this issue Oct 13, 2019 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@raderio
Copy link

raderio commented Oct 13, 2019

At the moment a transaction is rollback only if it was thrown a RuntimeException.

In Kotlin there is no checked exceptions, so compiler to do not force to check when is was thrown an Exception.
When some library from Java throw an Exception, in Kotlin methods with @Transactional annotation do not rollback.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 13, 2019
@raderio
Copy link
Author

raderio commented Oct 13, 2019

The quick-fix is to use @Transactional(rollbackFor = [Exception::class]) instead of @Transactional.
But it will be better to handle this by default in Spring.

@snicoll
Copy link
Member

snicoll commented Oct 13, 2019

Duplicate of #23473

@snicoll snicoll marked this as a duplicate of #23473 Oct 13, 2019
@snicoll snicoll closed this as completed Oct 13, 2019
@snicoll snicoll added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants