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

Throw runtime error for @TransactionalEventListener when @Transactional propagation level is not REQUIRES_NEW or NOT_SUPPORTED #33470

Conversation

Jaeyoung22
Copy link
Contributor

@Jaeyoung22 Jaeyoung22 commented Sep 3, 2024

After #30679, #31414, and #31907, if a method is a @TransactionalEventListener with a propagation level other than @Transactional(propagation = Propagation.REQUIRES_NEW) or @Transactional(propagation = Propagation.NOT_SUPPORTED), a runtime error will be thrown.

However, there is no runtime error yet for @Transactional with all propagation level on the top of the class.

For classes that use @Service with @Transactional at the top and don't attach this annotation to the method where the write operation takes place, there were cases where it didn't work as intended because no runtime error was thrown.

So I'd like to contribute to this.

@pivotal-cla
Copy link

@Jaeyoung22 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@Jaeyoung22 Thank you for signing the Contributor License Agreement!

@Jaeyoung22 Jaeyoung22 changed the title feat: Implemented to throw a runtime error if a class has @Transactional Implemented to throw a runtime error when using @TransactionalEventListener to method if a class has @Transactional Sep 3, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 3, 2024
@Jaeyoung22 Jaeyoung22 changed the title Implemented to throw a runtime error when using @TransactionalEventListener to method if a class has @Transactional Implemented to throw a runtime error if a class with a method with a @TransactionalEventListener has @Transactional and the propagation level is not REQUIRES_NEW and NOT_SUPPORTED Sep 3, 2024
@jhoeller jhoeller added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Sep 9, 2024
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 26, 2024
@jhoeller jhoeller self-assigned this Sep 26, 2024
@jhoeller jhoeller added this to the 6.2.0-RC2 milestone Sep 26, 2024
@jhoeller jhoeller merged commit cc3948e into spring-projects:main Sep 27, 2024
1 check passed
jhoeller added a commit that referenced this pull request Sep 27, 2024
@sbrannen sbrannen changed the title Implemented to throw a runtime error if a class with a method with a @TransactionalEventListener has @Transactional and the propagation level is not REQUIRES_NEW and NOT_SUPPORTED Throw runtime error for @TransactionalEventListener when @Transactional propagation level is not REQUIRES_NEW or NOT_SUPPORTED Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants