dcsimg
database row locking using, html, servlet, EJB, database model
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, March 21, 2001 08:25 AM

How do you maintain transactions between a web front end, Servlets, EJB's and the backend database. Let me give you a case scenario. web client 1 hits the database and gets x=0 web client 2 hits the database and gets x=0 web client 1 updates x to equal 10 web client 2 now has a non-repeatable read and a possibility of interleaving data exists Is there a way in this model to persist a transaction so a lock can be maintained on the database row. In an Oracle worksheet you can do a select for update and maintain the row lock, so when others hit this row they are put in queue and forced to wait until an explicit commit. In the J2EE model is this possible, and if not what is the workaround. Thank You for your    More>>

How do you maintain transactions between a web front end, Servlets, EJB's and the backend database. Let me give you a case scenario.

web client 1 hits the database and gets x=0
web client 2 hits the database and gets x=0
web client 1 updates x to equal 10
web client 2 now has a non-repeatable read and a possibility of interleaving data exists

Is there a way in this model to persist a transaction so a lock can be maintained on the database row.
In an Oracle worksheet you can do a select for update and maintain the row lock, so when others hit this row they are put in queue and forced to wait until an explicit commit. In the J2EE model is this possible, and if not what is the workaround. Thank You for your help on this matter.

   <<Less

Re: database row locking using, html, servlet, EJB, database model

Posted By:   John_Nilson  
Posted On:   Sunday, June 24, 2001 06:16 PM

http://developer.java.sun.com/developer/technicalArticles/ebeans/sevenrules/


mentions in one of the rules, to manually mantain transactional integrety. Read the EJB spec has not solved this problem but will in the future. We have the same problem and can't figure out why. Our theory is an an enumeration returned from one of the finder methods is not getting free by the GC and hense locking the database row. I sure hate having to code myself what I thought the ejb would do for me,I thought transactions were supposed to be easy.
About | Sitemap | Contact