Pankaj Tandon wrote:

> Since no one replied so far, I'll take a stab at it... :-)
> If a session bean(stateless) invokes the find on the entityBean
> AND if the following are set in the DepDesc of the session bean:
>        isolationLevel             TRANSACTION_SERIALIZABLE
>        transactionAttribute       TX_REQUIRED
> then that instance of the eBean shd be 'locked' till such time this session
>  bean is done.
> So to simulate a lock, you can
> - Make the first session bean do a myEBean.setDesc("Foo") ;
> - Put this sessio bean to sleep for a while
> - Attempt to retrive the same eBean thru a seperate client invoked session
> (thru a find on same PK) bean while the
> first client session is asleep.
> - set a diff desc as diffInstanceOfMyEBean.setDesc("Bar")
>
> At the end of both txns the desc shd be set to "Bar".
>
> At least in theory that shd work! I haven't tried it... :-(
>
> Pankaj
>
> Srinivas Hasti <[EMAIL PROTECTED]> on 11/05/99 10:52:11 AM
>
> Please respond to A mailing list for Enterprise JavaBeans development
>       <[EMAIL PROTECTED]>
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: pankaj tandon/MIS/genco/US)
> Subject:  Suggestions
>
> Hi,
>   I need to design/develop a entity bean which needs
> to do following
>  When a client access the ejb using finder method, if
> find is successful, i need to lock the row in
> database. Second client(doing find with same
> primarykey) should wait till first client is done
> before he can start modifying the row.
>
> Any hints/suggestions are helpful.
>
> Thanks
>   H
>
> =====
> class JSignature{
>  final static String name = "Srinivas Hasti";
>        static String email= "[EMAIL PROTECTED]";
>        static String ring = "919-484-3026";
> }
>
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.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".

Yes, exactly.  That is the whole point of
            isolationLevel             TRANSACTION_SERIALIZABLE
           transactionAttribute       TX_REQUIRED

We do it all the time.

The other alternative is using READ_COMMITTED and select <whatever> for update
(In fact, to digress into vendor specific stuff here, if you're using an ejb
server (in my case weblogic) with oracle, you better do this instead.  There is
a bug in oracle that results in failure under heavy load otherwise.)

===========================================================================
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".

Reply via email to