-->
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.  [ 1 post ] 
Author Message
 Post subject: Modified date on record via event listeners?
PostPosted: Thu Jan 06, 2011 4:30 pm 
Newbie

Joined: Fri Jan 23, 2004 5:31 pm
Posts: 5
I'm trying to set a modified date on records before they're saved. I'm using the session interface currently, so I can't use @PrePersist.

I've therefore stuck the logic in a SaveOrUpdateListener.

This basically works pretty well, except if someone calls save() or update() on an unmodified bean, the listener changes the mod_date and results in an update statement that otherwise wouldn't take place.

Is there a better way to do this - a different event listener or some way to determine if the bean has actually been modified before setting a modified date?

Thanks!


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

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.