• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is method @Transactional regardeless of invocation  RSS feed

 
Rade Koncar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

When I'm using @Transactional annotation on a method in a manager bean, is this method also transactional if invoked from within the bean itself?
I am asking this because I heard that spring manages this transactional behaviour by wrapping a bean inside a proxy. So if I call it from within a bean itself, then this wrapper will be avoided.
So it won't be transactional after all. Is this right? If so, is there any way to make method transactional regardless of invocation type?
 
Marco Behler
Author
Ranch Hand
Posts: 52
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rade,
you are completely right. If you call those methods from inside your bean, they won|t be transactional. There is a "self" workaround, like describe here: https://tinyurl.com/jjezmzy .
 
Rade Koncar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting workaround to this problem. Thanks!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!