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: How to store a historical data in another db tables
PostPosted: Thu Jul 26, 2007 6:19 am 
Newbie

Joined: Thu Jul 26, 2007 5:50 am
Posts: 2
Hello,

I' m facing a following problem: my business logic should historize an object graph in separated tables so I searched on the hibernate site and found this entry
http://forum.hibernate.org/viewtopic.php?t=969725
interesting:

<class name="Person" table="PERSON"> ....
<class name="Person" entity-name="HistoricalPerson" table="PERSON_HIST"> ....

However the suggested solution use entity-name enhancements witch would be available in the 2.0 nhibernate version.

How could I copy an object graph from my tables to the Hist_Tables in the same database?

Any hints are much appreciated!


Top
 Profile  
 
 Post subject: Re: How to store a historical data in another db tables
PostPosted: Thu Jul 26, 2007 9:56 am 
Newbie

Joined: Mon Aug 30, 2004 6:49 pm
Posts: 7
Location: Fort Washington, PA
Hello, I'm not sure of your exact requirements, but it may be easier to take care of the population of the historical tables outside of hibernate completely. I have done similar work in other projects. I will have a history table that is populated based on triggers on the main table. This way, Hibernate is taken out of the mix, performance is most likely increased and any changes made to the main table in the database (outside of Hibernate code) is propagated to the history table also. Then, if you need access to the history objects in your application, you can create a read-only collection from your main object to the child object within your hibernate mapping.

_________________
-- Ryan


Top
 Profile  
 
 Post subject: Re: How to store a historical data in another db tables
PostPosted: Thu Jul 26, 2007 1:35 pm 
Newbie

Joined: Thu Jul 26, 2007 5:50 am
Posts: 2
Hi Ryan,

Thanks a lot for your suggestion. May be you are right. But if I go "your" way, I have to manually navigate through the whole object graph (5-6 levels of depth) and I would avoid that if it would be possibly.

Best Regards,
Boris


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.