• Post Reply Bookmark Topic Watch Topic
  • New Topic

Puzzling Transactions.....

 
Rajan Punchouty
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
Please clarify this...

Session Bean psudo code

//this method has attribute = REQUIRED
public void method1(){
//statement 1 update some record
method2();
//statement 2
}

//this method has attribute = REQUIRED NEW
public void method2(){
//statement 3 update some other record
//exception is thrown
//statement 4
}

does statement 1,2,3,4 will happen in same transaction context OR 1,2 in different context and 3,4 in different context IF I CALL method1 FROM REMOTE INTERFACE

Thanx in Advance
 
Brian Tinnel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope someone will correct me if I'm wrong. But I think that everything will be under the same transaction. That is because the call from method1 to method2 is not done using the Remote interface, so the call isn't intercepted by the container.
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Brian Tinnel:
I think that everything will be under the same transaction. That is because the call from method1 to method2 is not done using the Remote interface, so the call isn't intercepted by the container.

Precisely. This took me an absurdly long time to figure out I'm sad to say. However, you can easily get around it by going through the local interface.

I found it helpful to add this code block to any beans that were calling themselves and needed those further calls to be intercepted. Just change the two local interface references as appropriate.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!