-->
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: Is there a way to manually check whether a field is dirty?
PostPosted: Tue Nov 08, 2005 6:25 pm 
Newbie

Joined: Sun Sep 11, 2005 3:28 am
Posts: 8
Hi,

My application maintains user information through web forms. Whenever a user changes their email address I need to send them a confirmation note to the new address.

So far my best option for determining email address changes seems to be adding logic to the setEmailAddress() method of my User POJO to track updates and to configure Hibernate with access="field" so as not to set the field on reads. After the save I need to send the email and reset the isEmailAddressUpdated flag.

Is there a more elegant way?

Thanks in advance,

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 7:21 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I would suggest that your proposed solution, to do it all in business logic, is correct most of the time. It has the advantage that if other processes are allowed modify the table, you don't detect a change by another process as making the field dirty.

If you can guarantee that no other process is allowed to access the DB, then your question is reasonable. I'd like to know the best answer myself: there have been a few topics recently about this, and they all admit to having to go back to the DB to check for dirty fields.


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.