Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3.0 transactions  RSS feed

 
Mark Washington
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I understand all the EJB3.0 transaction attributes such as required, requires new etc..

I have a small question, what does it mean when I see statements such as "If the caling method (the method calling the EJB method) is already running in a transaction". Does it mean if for example a servlet is calling the EJB in a transaction controled by JTA such as:

transaction.begin();
do some logic;
call the ejb method;
transaction.commit();

Thanks

Mark
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
Welcome to JavaRanch!

The scenario you posted is a possible one. A more common one is that one session bean (EJB) calls another one where the outer session bean already has a transaction. In this case, the container was responsible for the initial transaction.
 
Mark Washington
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply,

Just to verify your answer by example, is this correct,

Suppose one EJB1 method1 is calling EJB2 method2.

Method1's transactions attribute is requires new and method2's trasnaction attribute is also requires new.

My understanding is that method's one transaction will be suspended and method2 will be started in a new transaction.

Is this correct?

Thanks

Mark.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
That is completely correct!
 
Sobha Potluri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.....


Please expalin me this scenario. 1000 clients access the my application(Login user) which it was developed in EJB . how it will maintain .

for each client is it wil create new instance. using stateful bean .
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sobha,

Welcome to JavaRanch

Please create a separate thread to discuss your question. This topic is a year old and is not related to your question.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!