Skip to content

Questions about usage of @Transactional on protected and package-private methods + for self-invocation #42049

Answered by mkouba
omasseau asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Does the @Transactional annotation work on protected and package-private methods ?

Yes, it does. However, private methods are not intercepted. There's also the quarkus.arc.fail-on-intercepted-private-method config property - if enabled (the default), the build fails if a private method that is neither an observer nor a producer, is annotated with an interceptor binding.

  1. Is the @transactional annotation applied for self-invocation when calling a transactional method from the same service ?

@RemigiuszDudek is right. In Quarkus, intercepted self-invocation works but it's a non-standard feature because CDI does not define this behavior at all.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by omasseau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants