-->
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: using <version/>
PostPosted: Sun Mar 12, 2006 3:28 am 
Newbie

Joined: Sun Mar 12, 2006 3:16 am
Posts: 1
I am new to nhibernate and am wondering if it is possible to not have hibernate overwrite rows when a new object version is saved.

Current behavior...

Object in the DB looks like this to start:
key version column3
12 0 test

change column3 results in:
key version column3
12 1 testing

Can nhibernate make it so that after the change it looks like this?
key version column3
12 0 test
12 1 testing

So that I can keep a history for undo and such.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 6:33 pm 
Beginner
Beginner

Joined: Mon Nov 21, 2005 6:38 pm
Posts: 30
Location: New Zealand
I am using versioning, and AFAIK you cannot get NH to do what you want "out of the box".

I'm guessing that you would have to set up some sort of version table and control it manually. (I have no idea how, sorry i can't be of more help).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 12:34 am 
Beginner
Beginner

Joined: Sat Dec 10, 2005 6:22 pm
Posts: 28
Location: Chicago, IL
I would love this functionality as well. I tried using views and triggers and the whole thing got real sloppy and NHibernate would often not update b/c the trigger was returning the wrong rowcount back or I would have PK violations.

For now I am writing a custom interceptor and I created readonly versions of the objects I want to audit. When updates go through I create a new history object and save that to the db. It sucks b/c I now have n*2 the number of domain objects to maintain for tracking history.

If anyone has any other ideas I would love to hear them.


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.