This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes Persistence of updated objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Persistence of updated objects" Watch "Persistence of updated objects" New topic
Author

Persistence of updated objects

Kumara SharmaS
Greenhorn

Joined: Nov 08, 2011
Posts: 21
Hi All,

This is the scenario 'm facing, I have different objects that are persisted to the DB.
All these objects are updated by user actions, but not always.

How to know if a particular object is updated by the user or not on the server side? If its not updated theres no need to persist it.
Is having a dirty/update check on the object a solution, on which persistence depends?

Or is there a better way to handle this?

Cheers
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
You can not be sure if data is actually changed by user on UI or not.
If you don't want to update record if there is no change, then you will have to maintain a copy of original object in session scope, compare the changed object passed from UI with original object in session
and then if there is any change , update the record in database.
 
jQuery in Action, 2nd edition
 
subject: Persistence of updated objects