"Bhattacharyya, Ana" wrote:
>
> Hi
> This should not happen as the data bean ie an entity bean is locked by the
> container during a transaction.
This might or might not be true. If you aren't sure the database
row is locked by ejbLoad, I recommend using optimistic concurrency
control, e.g. on ejbLoad use something like:
ResultSet rs = stmt.executeQuery("select field1, field2, ..., counter from table
where key=keyValue");
int oldCounter = rs.getInt("counter");
For ejbStore use something like:
int newCounter = oldCounter + 1;
int rows = stmt.executeUpdate
(
"update table set field1=value1, field2=value2, ..., counter=" + newCounter
+ " where key=keyValue and counter=" + oldCounter
);
If rows == 0 after the update, then either the row was deleted
by another client or the row was updated by another client.
Note: this is just an example - there are many ways to achieve
optimistic concurrency control.
> Ana
>
> -----Original Message-----
> From: Tom Jordan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 08, 2000 5:33 PM
> To: [EMAIL PROTECTED]
> Subject: Working with Transcations
>
> Hi
>
> I was wondering if anyone can recommend or point me to a resource on
> management transaction through ejbs. In particular I would like to know how
> you would handle the following scenario:
>
> User A gets data from bean
> User B gets data from a bean
> User B updates the data
> User A tries to update the data ends up overwriting the data from B.
>
> First of all in EJBs, would this situation happen? If it does, how can you
> structure things such that the bean is notified of the change and does not
> overwrite the data.
>
> Thanks
> Tom
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> ===========================================================================
> 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".
--
________________________________________________________________________________
Evan Ireland Sybase EAServer Engineering [EMAIL PROTECTED]
Wellington, New Zealand +64 4 934-5856
===========================================================================
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".