-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to create a changelog
PostPosted: Thu Dec 04, 2003 3:18 pm 
Newbie

Joined: Thu Dec 04, 2003 3:10 pm
Posts: 9
Location: Rio de Janeiro, Brazil
Hi,

I need to create a changelog of my database. Every time an instance of some entity changes, I need to persist the changes it in my changelog database.

The problem is that I need to know WHAT changed, and persist the old value and the new value to the changelog.

First, I've tried to use the Lifecycle callbacks, and at onUpdate, load the actual entity persisted state and compare it with memory state. Of course it doesn't work, probably because the persisted and in-memory entities instances have the same id.

Second, I tried to use the Interceptor. The onFlushDirty method receives an array of previousState properties. But this arrays always came null !!!

Anyone have already faced with this problem ?

Thanks in advance,

Joao


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 4:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Look at the AuditInfo pattern on the wiki....(it uses the interceptor - and it works ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 4:22 pm 
Newbie

Joined: Thu Dec 04, 2003 3:10 pm
Posts: 9
Location: Rio de Janeiro, Brazil
Ok, but the audit info (I'm almost sure) just uses time (like time created, time update anb so on) information.

It doesn't need to read already persisted data like I need. That's my problem. I couldn't compare persisted data with in memory data.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 4:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
joaocm wrote:
Ok, but the audit info (I'm almost sure) just uses time (like time created, time update anb so on) information.

It doesn't need to read already persisted data like I need. That's my problem. I couldn't compare persisted data with in memory data.


...hmm...the method overwritten in the AuditInfo allows yourself to "rememeber" the state of specific instances! Just put them in your own map and keep the bookkeeping ya'self ...should not be that hard ?

_________________
Max
Don't forget to rate


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