Hi!
Beware of the fact that on most databases you will not only lock the
specified row but the whole db page where this row exists. There is not
so many databases that supports row level lock, most of them do lock per
db page.

/Lennart

> Jay Walters skrev:
> 
> As I said this will slow things down, but if you use a commit option
> which causes an ejbLoad() for every transaction which I think is
> option C, then in your ejbLoad() code execute your "select ... from
> ... where ..." with the additional clause on the end "for update of
> ..." where "..." is one or more fields in the object then you will
> have locked the row for the duration of the transaction in the
> database.  When JBoss commits the transaction then the database will
> unlock the row.  I don't know that SELECT...FOR UPDATE is supported by
> all the mickey mouse databases like Hypersonic and the like, but it
> should be supported by anything you'd use on a production site.
> 
> Cheers
> Jay Walters
> 
>      -----Original Message-----
>      From: Javier Gallardo [mailto:[EMAIL PROTECTED]]
>      Sent: Friday, January 05, 2001 3:17 AM
>      To: jBoss
>      Subject: Re: [jBoss-User] Locking registry
> 
>      How?  Has you a example?
> 
>      Jay Walters wrote:
> 
>     >  select .... for update could be used to lock on read
>     >  during the ejbLoad() method.  Note this could really slow
>     >  things down.
>     >
>     >  Cheers
>     >  Jay Walters
>     >
>     >       -----Original Message-----
>     >       From: Javier Gallardo [mailto:[EMAIL PROTECTED]]
>     >       Sent: Thursday, January 04, 2001 9:52 AM
>     >       To: jBoss
>     >       Subject: Re: [jBoss-User] Locking registry
>     >
>     >       How can we lock a table row (database) in jboss?
>     >
>     >       Rickard Öberg wrote:
>     >
>     >      > Hi!
>     >      > Javier Gallardo wrote:
>     >      >
>     >      > > How can we lock a registry in jboss or via
>     >      > > database?
>     >      > >
>     >      > What is a "registry" and how do you want to
>     >      > lock it?
>     >      > /Rickard
>     >      >
>     >

-- 
mailto:[EMAIL PROTECTED]
http://www.benefit.se/english


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to