Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SessionBean calling it's own method

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings all,

Suppose I have a SessionBean called FooBean and it has three business methods:

Only method "whine" is exported to the remote interface. So when I call whine(); I want to know if simpleMethod() is correct since I am calling it like any java method. Or should I rewrite simpleMethod() like this:

Note that the transaction type for method bleat is "RequiresNew" and for method croak is "Required".

I hope someone can confirm this for me. Thanks.

Regards,

Pho
 
Mudi Appu
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simpleMethod is correct as far as transaction type of each method are set to default.

Anyway you don�t need to call following methods in order to call a method of same EJB object (this is not depends on transaction type)

[ April 25, 2005: Message edited by: Kanishtha Kramalekhaka ]
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kanistha,


Anyway you don�t need to call following methods in order to call a method of same EJB object (this is not depends on transaction type).

My concern for this is because I want the code block inside bleat() to always run in a new transaction context. If bleat() crashes with some exception, it should not rollback whine() in any way. croak() will obviously inherit the tx context of whine.

Pho
 
Mudi Appu
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to your code, if bleat() crashes with some exception whine() will be rollback definitely. If you want to avoid that, In addition to setting tx to required new you should handle exceptions correctly.
here is the code



What the following code does is
Create new ejb object within the method and call bleat() and croake() methods of that new ejb object. But in this code ; If bleat() crashes with some exception, whine() should rollback definitely.

 
Create symphonies in seed and soil. For this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!