-->
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: Need a guru advise on internals (Audit Info)
PostPosted: Tue Nov 11, 2003 7:58 am 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Hello. There is very useful (for me at least) implementation of audit info in the Hibernate communiti area:

http://www.hibernate.org/48.html

1. Original solution is probably for very old version of Hibernate because does not implement all of Interceptor methods. There is followup ( http://www.hibernate.org/48.43.html ) which adds these methods. But for me it has a big problem - to check if old and new values are the same, it uses old.toString().equals(new.toString()) or something like that.

Imho, this is terrible. I looked at Hibernate sources but found no easy way to compare current and previous state of an object. Ideal solution would be to let Hibernate perform dirty check by itself and then only modify the list of dirty columns.

Is it possible?

2. I would like to modify the Audit Info to let user Id be any object not just Long. But in this case i have problems in nullSafeSet/nullSafeGet because I do not know how to bind/get values properly. Is it possible to configure custom type from Hibernate's mapping files?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 3:59 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Just found Interceptor gets list of all properties including collections. Comparing two collections using toString() definitely sucks. But I'm afraid even if I will use just object.equals() this will cause loading of lazy sets. What to do?


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.