-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to obtain original state of entity instance bound to PC
PostPosted: Thu Jan 29, 2009 3:42 pm 
Hibernate remember the original state of the object bound to persistence context. I'd like to obtain that state to build a set of changed properties. For example any JIRA issue contains a history of changes.

It's not simple as might seem for the first glance because entityManager.find() method returns the already changed object. But I need the original state of the object.

I'm wondering can I obtain it using JPA delegate (Hibernate API)?


Top
  
 
 Post subject:
PostPosted: Thu Jan 29, 2009 6:47 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
You can register an Interceptor implementation with Hibernate and you will get callbacks with lots of information at various stages of an entities life cycle. Here is the API docs: http://www.hibernate.org/hib_docs/v3/ap ... eptor.html and here is a simple example: http://www.hibernate.org/hib_docs/v3/re ... terceptors


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