At 09:38 AM 23/11/99 +0000, Robert Hargreaves wrote:
>Our application needs this level of locking and we were going to use a
>non-persistent entity-bean variable to do this. If your not guaranteed to be
>using the same instance for different clients then I'm not sure how to set
>up the transactional attributes to use the database locking. The way we'd
>like it to work is as follows:
You can use an isolation level of TRANSACTION_SERIALIZABLE, but I have
a funny feeling Jonas doesn't support isolation levels yet, so it's
dependent on your database server's default for a connection.
Most of which are usually TRANSACTION_REPEATABLE_READ
>We have an entity bean with CMP. Originally we had get & set methods for the
>required data, but after reading this article
>
>http://www.javaworld.com/javaworld/jw-11-1999/jw-11-ejb.html
>
>we decided to go for a single getProperties() method that would return all
>persistent attributes in a wrapper object, to reduce the number of network
>calls. The locking would exclusively lock the entity bean when this
>getProperties() method was called, so that other clients could view old data
>on a read-only basis. When the setProperties(Props) was called the lock
>would be removed and other clients could then read, lock and update the new
>data.
>
>Can this level of locking be done automatically with EJB, or like you said,
>would you have to use a boolean isLocked field in the database (which would
>be dangerous if the system crashed). Also, if this sort of locking can be
>done, would be the same for all major databases - I know some cheapo
>databases lock the whole table in certain scenarios.
>
>Regards,
>
>Robert Hargreaves
>
>
>-----Original Message-----
>From: Jim Richards [mailto:[EMAIL PROTECTED]]
>Sent: 23 November 1999 01:17
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: Re: RMI and EJB problem?
>
>You are not guareenteed to be using the same instance of an object
>with entity beans. Why do you want to do this locking anyway? There are
>other way of doing this with either the transactional attributes or with
>a boolean in the database (so other non-ejb applications can make use of it)
>
>If you really need to do this make the boolean a static variable, this means
>there is only one for all instances.
>
>
>--
>Subvert the dominant paradigm
> http://www.cyber4.org/members/grumpy/index.html
>
--
Subvert the dominant paradigm
http://www.cyber4.org/members/grumpy/index.html