-->
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 get OldValues[] or oldState while using update()
PostPosted: Tue Dec 19, 2006 2:41 am 
Newbie

Joined: Tue Dec 19, 2006 1:59 am
Posts: 2
Hi all,
im new to hibernate & spring. Im using it in my project.
i use HibernateTemplate.update() to update the data base. I need to audit log the same.
My Problem :
How do i get OldValues[] or oldState of the object.
1. I tried through an interceptor extending EmptyInterceptor, the interceptor was invoked but still the oldValues[] are null.

2.I also tried it with PreUpdateEventListener. the ListenerEvent was invoked. But still event.getOldState() is returning null.

Can somebody help me how to obtain oldValues[] or oldState while using
HibernateTemplate.update() ?

Thanks in Advance...

_________________
Thanks & Regards

vinoth


Top
 Profile  
 
 Post subject: OldValue
PostPosted: Tue Dec 19, 2006 5:39 am 
Beginner
Beginner

Joined: Wed Aug 31, 2005 3:54 am
Posts: 45
Oldvalue handling isn't an Hibernate feature.

You can use PropertyChangeListener (http://java.sun.com/docs/books/tutorial ... index.html) to follow the value changing and retreive old value.

Bye.


Top
 Profile  
 
 Post subject: sorry asic... you have miss understood the question.
PostPosted: Tue Dec 19, 2006 7:05 am 
Newbie

Joined: Tue Dec 19, 2006 1:59 am
Posts: 2
I want spring to retrive the old values from the database before it updates a row.

My Interceptor which extends an EmptyInterceptor does give the old values when HibernateTemplate.merge(obj) is called. where as HibernateTemplate.update(obj) doent give me oldValues[]. Its always null inside the inteceptor.


getHibernateTemplate.merge(obj) is expensive.
So i need to replace it with getHibernateTemplate.update(obj).

But when i use update i face the above mentioned problem.

Can SomeBody help me...

_________________
Thanks & Regards

vinoth


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 5:44 am 
Newbie

Joined: Mon Apr 30, 2007 12:27 pm
Posts: 18
hi! im facing the same problem that you had, and I am kind of stuck.

Did you get any solution?

thanks.


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.