-->
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: Always get null from PostUpdateEvent#getOldState()
PostPosted: Wed Jan 21, 2009 6:28 am 
Newbie

Joined: Wed Jan 21, 2009 5:45 am
Posts: 1
Location: Germany
Hello,

I try to register a PostUpdateEventListener via the hibernate.cfg.xml. Everything works fine but some values I get with the PostUpdateEvent object are at least strange.

The one thing which is most critical to my intended use is the getOldState method always returns null. I searched around and found other places where people ran into the same issue but without a hint to a solution.

This must be working somewhere - but there seems to be a certain setup where this does not work. Also JavaDoc unfortunately is quite thin in this area. Might be I just miss the right pointer?

Also the timestamp returned from PostUpdateEvent#getSession()#getTimestamp() should be 'System time before the start of the transaction' returns a strange (far to low) value, at least when I interpret it as milliseconds since 1970. This is not critical to me but it might be a hint to the issue.

I can not say much about the other fields except that the PostUpdateEvent#getState() seems to be populated as expected as the PostUpdateEvent#getPersister() returns (at least some) valid data.


I'm using Hibernate 3.2.6.GA in a IBM Websphere 6.0.2 on a 1.4.2 IBM JDK with a jta based session context backed by an Oracle 10g. The issue also occurs in the test setup where ThreadLocalSessionContext is used.

Any hint is welcome,

Kind Regards, Andreas.


Top
 Profile  
 
 Post subject: Re: Always get null from PostUpdateEvent#getOldState()
PostPosted: Tue Jun 08, 2010 4:26 am 
Newbie

Joined: Tue Jun 08, 2010 4:24 am
Posts: 1
I also see the same issue.. anyone got a solution for this ?


Top
 Profile  
 
 Post subject: Re: Always get null from PostUpdateEvent#getOldState()
PostPosted: Wed Nov 03, 2010 6:15 am 
Newbie

Joined: Thu Oct 28, 2010 8:38 am
Posts: 4
Location: Ukraine
I resolved this problem by using session.merge(entity) instead of session.update(). Then getOldState() returns not null value.


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.