Or, you could use CMP in a system that has optimistic locking. That would do the same thing, but no code is required.
Jonathan Krishnan Subramanian wrote: > > Serkan, > > It is generally a bad idea to lock rows for a period that spans > user think time. In your case, the client could forget he|she > has locked data, go for a cup of coffee or the client app itself > could crash. In this case, the DB Admin would have to manually > kill the hanging transaction or set a transaction timeout. > > A better solution would be a versioning mechanism to ensure that > users do not overwrite each other's data. See the thread: > http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind0106&L=ejb-interest&P=R23083 > for some details on how this could be implemented. > > -krish > > > -----Original Message----- > > From: A mailing list for Enterprise JavaBeans development > > [mailto:[EMAIL PROTECTED]]On Behalf Of Serkan Oktar > > Sent: Thursday, March 07, 2002 1:16 PM > > To: [EMAIL PROTECTED] > > Subject: basic transaction management and isolation level question > > > > > > Hi, > > > > Although I ve written many many pages about EJB I could'nt suceed to clarify > > some very basic points. In order simplifying the case I created an example.. > > Can anyone make a suggestion for this case. I need help becasuse I am > > totally blocked at this point. > > > > Assume we have a session bean (S) and two entity beans (A,B). There should > > be two basic methods in session bean S's remote interface, one for getting > > data (readData()) and one for updating (updateData()). > > > > Both of these methods should access the entity beans A and B. Remote > > interfaces of them will be accesses by calling findByPrimaryKey() methods, > > data will be read by getter methods in readData() and updated by setter > > methods in updateData(). > > > > My question is about transaction management. How can I gurantee that the > > data read in readData method will be locked till the updateData method > > terminates. Assume data collected are represented on a GUI and client waits > > N seconds and then triggers updateData method. > > > > 1) Which transaction attributes and isolation levels should be selected for > > session Bean S,entity bean A,B and more importantly for methods readData() > > and update Data()? I think there should be a transaction which begins with > > readData and ends with updateData(). > > > > 2) More basic question about session Bean. Should it be stateless or > > statefull? I could'nt find a solution because I am doing the same job in > > both cases.. > > > > Thanks for everyone who has read this and more thanks who can save me , > > Serkan > > > > =========================================================================== > > 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". -- Jonathan Baker Senior Architect eBusiness Division Sybase, Inc. [EMAIL PROTECTED] +1 301 896 1363 =========================================================================== 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".
