Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

foo2RequiresNew  RSS feed

Swamy Nathan
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say bean method foo1Required() is running under transaction tx1. Lets say inside foo1Required() it invokes another method foo2RequiresNew().

The method names also indicate the tx attribute declared in the dd.
Inside foo2RequiresNew() the transaction is a new transaction and it cannot see the transaction in foo1Required().

Which means the changes made to bean fields inside the foo1Required() method before the foo2RequiresNew() method should not be visible to foo2RequiresNew() method.
But to make life easy I guess it should be visible.
If foo2RequiresNew() method completes then the method foo1Required() takes over with bean fields changed by foo2RequiresNew()
But if now there is a rollback how does rollback effect this?

Changes to the bean fields inside foo2RequiresNew() should be committed but those inside foo1Required() before and after the method call foo2RequiresNew() should not be commitede but rolled back.
==>How can that be?

==>Or is it that when a bean method invokes another bean method there is a special case and foo2RequiresNew would not start a new transaction?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!