-->
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: How to check if object is dirty
PostPosted: Wed May 09, 2007 2:29 pm 
Newbie

Joined: Wed May 09, 2007 2:25 pm
Posts: 4
I understand that hibernate performs automatic dirty checking on the domain object before persisting it.

I have a requirement to log the event every time a record is modified. Is there any API that I can use to check if an object is dirty?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 10:14 pm 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
There are a few things you can do.

You can use interceptors.

http://www.hibernate.org/hib_docs/v3/re ... terceptors

or Event listeners

http://www.hibernate.org/hib_docs/v3/re ... ate-events
http://www.hibernate.org/hib_docs/entit ... le/#d0e496

or the @PreUpdate callback from Entity Listeners (This is JPA compliant).

http://www.hibernate.org/hib_docs/entit ... #listeners

For me, personally, Entity listeners seems to be the cleanest.

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


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.