Hi Bill:
Is myEntityBean.checkValue() checking the value of a persistent field? If
so, why can't that call be part of your transaction ... i.e.,
// start transaction
if (myEntityBean.checkValue())
{
myOtherEntityBean.update();
myEntityBean.update();
// end transaction
}
// end critical section
If you need a write lock on the value you are checking, you probably need to
use BMP so you can do a SELECT ... FOR UPDATE. You probably want an
isolation level of Serializable.
Is there a reason why making myEntityBean.checkValue()part of the
transaction is unworkable? Some more background on what you are trying to
accomplish with myEntityBean.checkValue()would be helpful ...
Laurel
-----Original Message-----
From: Bill Leonard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 6:20 AM
To: [EMAIL PROTECTED]
Subject: critical sections in beans (transactions?)
I have the following SessionBean method and want to block other clients when
they try to call checkValue() if another client is already in the critical
section. Further, I need to execute an update to the enity bean and another
entity bean in a transaction.
Can I do this using transactions and isolation levels in EJB?
MySessionBean
{
mySessionBeanMethod()
{
// start crtical section
if (myEntityBean.checkValue())
{
// start transaction
myOtherEntityBean.update();
myEntityBean.update();
// end transaction
}
// end critical section
}
}
Thanks,
Bill
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".