-->
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.  [ 5 posts ] 
Author Message
 Post subject: Audit information to SAME table as entities?
PostPosted: Fri Mar 17, 2006 12:51 am 
Newbie

Joined: Fri Mar 17, 2006 12:41 am
Posts: 3
Is it possible to use Hibernate (2.1.8) Auditable and Interceptors to populate audit information (date, user) to fields in the same table that maps to a given entity?

Say I have Customer which maps to the CUSTOMER table and want the fields LAST_MOD and LAST_MOD_USER to be populated. And I also have Order which maps to the ORDER table, and has the same fields.

I know I can insert records to a separate CUSTOMER_AUDIT table, but I want to update to the same table. Will this screw up the transaction or hibernate session?

Any examples on the web anyone can point me to?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 17, 2006 6:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There is an example of this on the Wiki (and I think in HIA).


Top
 Profile  
 
 Post subject: audit log
PostPosted: Mon Mar 20, 2006 7:11 pm 
Newbie

Joined: Fri Mar 17, 2006 12:41 am
Posts: 3
I have _Hibernate in Action_ (the 2.x version) and the example there is for a separate table, not the same table as the entity. I'll search the wiki.

But actually in thinking about it some more, audit info in the same table doesn't make sense now to me anyway. You'd only be able to store the latest update info, losing the audit trail itself, and you wouldn't be able to retain audit info for deleted records....so perhaps that is why I didn't see an example of it earlier. It seems that storing info in a separate audit table is the way to go.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 2:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
On the same row some times there are requirements to record when that row was last updated or first saved. Otherise history is needed in a separate table.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 4:41 am 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi,

I don't have HiA, can you direct me to the WIKI that you mention on how to do the audit trail for my reference?

Thank you.

_________________
Thank you.

Regards,
Jap.


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