-->
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.  [ 3 posts ] 
Author Message
 Post subject: writing history logs
PostPosted: Thu Oct 14, 2004 8:08 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
Hibernate version:
2.1.6 on a AS400/DB2

Hi,

i've got to write some history-logs to db (orginally read values), but i'm not allowed to use triggers because some existing apps writes to the same db/tables and are writing those history-entries on there own ... using triggers will cause duplicate entries in history-tables :(

and i don't think that it's possible to determine in a trigger which application tries to update data!?

Is there a 'nice' way to do this with hibernate?
Is it possible (using detached objects) to get the initial read objects from cache? Or is the only possibility for me to remember the read objects?
And i really wouldn't like to do that ;)

I've looked at the "Interceptor" but it's not suitable. So isn't the use of the 'lifecycle-callbacks" mentioned in chapter 4.4.

In fact it would be great if there's a possibility to get the initial read values. But i'm not really sure if hibernate is able to give them to me, because i'm working with detached objects and different sessions.

If there's no other possibility i hab to "clone" my objects before using them ... but of course this won't win a design-award ;) because then i had to determine when exactly to delete this cache and other bad things ....

The following possibilities i've found:
- using triggers and a NamingStrategy that allows me to identify my own app in a trigger
- clone the persistence-objects and "cache" them

Currently i think "version 1" could be a better choice to awoid the caching- and cloning-problems ... (if there isn't a better way with hibernate - well knowing that hibernate could not fit to every 'strange' use-case ;) )

thx!
curio


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 14, 2004 10:02 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I think "current_user" function in trigger can help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 14, 2004 5:18 pm 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
yes, thanks a lot! this was it ...

the function is named "user" ... for everyone else here who needs to 'fight' with a as400/db2 ;)

The Trigger itself was a little bit tricky because of some points which simply seems not to work with as400 ... but now i got it work ... perfect!

thanks a lot!!

gtx
curio


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