Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Beans > Re: How long is...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 1265 of 1401
Post > Topic >>

Re: How long is a CMP EJB locked in a transaction?

by "Doug Pardee" <dougpardee@[EMAIL PROTECTED] > Nov 28, 2006 at 08:19 AM

Joost Kraaijeveld wrote:
> If I have a long lasting transaction in Stateless SessionBean during
> which I load an CMP EJB bean, how long is that EJB bean locked? From
> it's ejbLoad untill the total end of the transaction, even if I only
> call it's getters?

Yes, you are correct.

I avoid using entity beans, and that is one of the big reasons that I
avoid them.

You have a few options. First, it is possible that your particular
container (EJB server) provides a way to indicate that an entity bean
is "read only". Of course, this means that if you also need to update
the data you will need 2 EJBs: one that is read-only and one that is
read-write.

If you only need the entity bean for a short time, and later changes to
the entity data by other processes will not affect your main
transaction, you could cause the entity bean to be accessed in a
separate transaction which only lasts for as long as you need that
entity bean. This would probably involve a new session bean which
performs all of the entity bean access, with the business method marked
as RequiresNew.

Personally, instead of adding a session bean that access the entity
bean, I would create a session bean that accesses the database directly
with JDBC, and get rid of the entity bean entirely.
 




 2 Posts in Topic:
How long is a CMP EJB locked in a transaction?
Joost Kraaijeveld <J.K  2006-11-27 20:36:48 
Re: How long is a CMP EJB locked in a transaction?
"Doug Pardee" &  2006-11-28 08:19:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:18:01 CST 2008.