Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB transaction

 
happy cheng
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the servlet there is following method:

ejbRequiredCall() is an ejb call that specify transaction as Required, which run some db transaction.
my question is, for the looping part, every ejbRequiredCall will be a separated transaction, right? or it will fall into one transaction. Thanks.
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You transaction starts when the EJB method is started. So each call to the EJB method will be in a diff transaction.

Thanks,
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Happy cheng"

Please review The JavaRanch naming policies, as your name appears to be clearly fictitious.

To your question, what exactly is ejbRequiredCall? Also, I'm not sure why you're starting threads in J2EE or EJB, its considered a bad practice to be doing any kind of thread management in such an environment (thats what the server is for).

To Amit, why would each call to an ejb create a transaction? It all depends how the EJB transaction attributes are configured for the ejb. Maybe there's part of this question I'm missing.
 
happy cheng
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Amit. That's what I thought but need confirm.
To Scott,
1. my name was taken by others, it seems this forum forbid two people use same name , so what's better the sounded real fake name and my current one.
2. ejbRequiredCall is an ejb call which defined as transaction 'Required'
thanks.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic