wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes How solve this scenario? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How solve this scenario?" Watch "How solve this scenario?" New topic
Author

How solve this scenario?

Firoz navrang
Greenhorn

Joined: Oct 18, 2007
Posts: 4
Hi All,

I have one scenario and that could solve by Java.

UserA is updating a record into db, but at the same time UserB wants to check the old recored from the same db. If a userA updated a record, then how can a userB can see the old record, because the old record is overwrited in the db.

This can be solve with Java or J2EE.

Help would be appricaite.

Thanks
Gaju
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You can set your translation isolation to allow dirty reads, but I don't think this is your question.

If you want both the old and new data to be available, you need to manage that yourself, such as inserting a new value then anly allowing A to see the latest value but allowing B to see all historical values.
Rejeev Divakaran
Greenhorn

Joined: Aug 12, 2007
Posts: 27
I think he is looking for 'read-committed'. If you use read commited concurrncy level. B will see old value untill A commit the transaction. If you want B to see old values even after A commits then you need to manage yourself.


Regards,<br />Rejeev<br />Blog: <a href="http://rejeev.blogspot.com/" target="_blank" rel="nofollow">http://rejeev.blogspot.com/</a>
Firoz navrang
Greenhorn

Joined: Oct 18, 2007
Posts: 4
Hi,

Still, I am not clear about the scenario. Can you please eloborate bit more, and if you have any example similar to that, I really appriciate.

Thanks

Fyrose
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

If the transaction that updated the record has committed, then your only option is to implement some sort of history table mechanism in your model. By this you use a trigger to copy data from your main table to a history table before any update is made. Is this the sort of thing you are looking for?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: How solve this scenario?
 
Similar Threads
How to solve the issue
could i prepare JMS for tranfer wav file?
how to reload data from db when using DataTable and preserveDataModel is true
changing datasource at runtime in CMP
Session Crossover With Tomcat 5.5