I think you mean  "any time you want to work pessimistically" ....

This is an outstanding issue.... I have also been wrestling with the same
thing for a while now.... and it seems, for now,  that the kludgy timestamp
method is about the only solution.... I saw some more discussion on this
issue on  www.theserverside.com about this very issue, but I forget exactly
where on the web site....

 EJB doesn't address "pessimistic" row level locking in a stateless
environment --BUT IT SHOULD! EJB must address this issue at some point... it
is such a  basic requirment! The whole idea of the J2EE is to provide a
framework of basic utilities shared by applications.

Keith

----- Original Message -----
From: "Jonathan Goldberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 04, 2001 11:07 PM
Subject: Re: Record-locking in J2EE/JSP/Servlet apps?


> Hi Bill
>
> I don't know that this problem is specific to JSP, and
> I don't know if EJB solves the problem automatically.
>
> Basically, any time you want to work optimistically, you
> will need to verify that the data you are trying to update
> is the data you retrieved.  One manual strategy is to add
> a timestamp to the table(s), and do something like:
>
> {
> retrieve data without transaction
> display data to user
> }
>
> later on
> {
> get data sent by user
> open transaction
> retrieve data from database
> compare timestamps
> if same then
>         {
>         update data with user database
>         update timestamps
>         commit transaction
>         send OK confirmation to user
>         }
> else
>         {
>         rollback transaction
>         send new data and error message to user
>         }
> }
>
> Hope this helps
>
> Jonathan
>
> ==========================================
> Jonathan Goldberg       8, HaP'nina Street
> Amdocs (Israel)         Ra'anana, 43000, Israel
> +972-9-7762071 (work)   +972-9-7763800 (fax)
> mailto:[EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Hines, Bill [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 04, 2001 9:44 PM
> To: [EMAIL PROTECTED]
> Subject: Record-locking in J2EE/JSP/Servlet apps?
>
>
> How are any of you solving the problem in the stateless webapp context
where
> two users pull up the same record from a database in a JSP page, and user
> one changes the address and saves but then user two, who has the old
address
> on his JSP page, changes the phone number and hence over-writes user one's
> address change? Are you locking the record in the back-end database and
then
> implementing the SessionBindingListener to release it when the session
> expires, if the user leaves the webapp without logging out? Does EJB solve
> this problem? I'd like to hear the solutions that are out there.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to