-->
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.  [ 6 posts ] 
Author Message
 Post subject: best way to audit changes to collections
PostPosted: Thu Jun 24, 2004 10:17 am 
Newbie

Joined: Thu Apr 08, 2004 10:24 am
Posts: 19
Location: Raleigh, NC
when a persistent collection is modified, Hibernate wont call the interceptor method onFlushDirty() unless the entity is versioned or a non-collection property has also been changed. i understand that this is by design but i don't understand the rationale behind the decision. i would happily use versioning if it didnt cripple batch updates. as it stands, i see no clear way to audit modifications to many-to-many bi-directional associations.

thoughts?

b


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 10:42 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Christian wrote
http://blog.hibernate.org/cgi-bin/blosx ... rytriggers


i don't know if this fit with your needs ...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 11:37 am 
Newbie

Joined: Thu Apr 08, 2004 10:24 am
Posts: 19
Location: Raleigh, NC
anthony,

thank you for the link. your blog is interesting. how do you reconcile changes to third normal tables? e.g. what if you want to reconstruct the state of an entity, including all of its relationships (1.*, *.1, *.*), at a given moment in time?

b


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 11:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i think you have to use only the view... not the two source tables

i may not understand your question...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 11:46 am 
Newbie

Joined: Thu Apr 08, 2004 10:24 am
Posts: 19
Location: Raleigh, NC
suppose you have two entities that share a many-to-many relationship. e.g.:

Code:
public class Person extends Persistent
{
   private Set departments;

   public get/setDepartments();
}

public class Department extends Persistent
{
   private Set people;

   public get/setPeople();
}


the people-departments association is mapped via a PersonDepartment third normal table (each row in this table will have a max version number of 1).

now suppose i want to answer the question "to what departments did Person XYZ belong to on June 5th 2003?". we can assume for argument's sake that we know Person XYZ's record was at version 5 on June 5th 2003.

b


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 12:01 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
So, use the same pattern for the link table, with a trigger and a view.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.