Hi Anish:
I don't understand your answer. In the app servers I have worked with, if
you are using a DataSource, autocommit is always turned off. If
container-managed transactions are not being used, the transaction is
demarcated via UserTransaction::begin() and
UserTransaction::commit()/UserTransaction::rollback(), even if an update is
performed.
Do you advocate by-passing the DataSource/UserTransaction classes? If so,
what is your reasoning? (e.g., performance?)
Thanks.
Laurel
-----Original Message-----
From: Anish Malhotra [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 9:05 AM
To: [EMAIL PROTECTED]
Subject: Re: critical sections in beans (transactions?)
If you do not do an update, you need to point to the container that the
transaction is over, either by manually saying it or by throwing a remote
exception in case of one.
Anish
-----Original Message-----
From: Bill Leonard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 11:30 AM
To: [EMAIL PROTECTED]
Subject: Re: critical sections in beans (transactions?)
Thanks, Laurel, for looking at this.
I put the checkValue() function as part of the transaction. My question: if
I don't subsequently perform an update on the data, I assume EJB will tell
the resource manager to release the lock?
THanks,
Bill
-----Original Message-----
From: Laurel Neustadter [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 9:38 AM
To: 'Bill Leonard'; [EMAIL PROTECTED]
Subject: RE: critical sections in beans (transactions?)
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".
===========================================================================
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".