-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Updates when data is not changed
PostPosted: Wed Feb 07, 2007 5:03 pm 
Newbie

Joined: Wed Feb 07, 2007 4:57 pm
Posts: 1
In my application, data gets loaded from screen search feature for an entity. Then the user can change data and click update. I use struts. In the DAO layer after all validations, i load a hibernate object, set new values and do a save() and flush(). It inserts or updates the data fine.

My issue is when the user does not change anything and clicks update button, hibernate still updates the row with the same data. Only thing that is changes is the changeTime that gets updated by a trigger. Also the trigger inserts a row into history table. So i see a new row in history table for every empty update.

Is there any solution for this? Does any one else also have same issue.

iam using hibernate 2.

Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 2:45 am 
Newbie

Joined: Mon Dec 18, 2006 2:39 am
Posts: 16
As far as I know, i believe each time it will do a save or update.

Maybe create some logic that selects count(*) ...which would search for any row that matched the users submission exactly. If the count = 0 then you know the users changed something and an update/save needs to be done.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.