-->
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: Committed update is not applied to already loaded object
PostPosted: Thu Sep 24, 2009 9:45 pm 
Newbie

Joined: Thu Oct 25, 2007 9:39 pm
Posts: 7
Consider the following transactions with isolation level = READ_COMMITTED.

Tx-1
T1: Get object with id = 1. Returned object has name = "X"
T2: Sleep for 10 sec
T3: Get object with id = 1, Returned object has name = "X"

Tx-2
T2: Update name of object id = 1 to "Y"

Why is Hibernate not updating the name to "Y"? It does follow the isolation level if we delete object id = 1. In this case, it returns a NULL record.


Top
 Profile  
 
 Post subject: Re: Committed update is not applied to already loaded object
PostPosted: Fri Sep 25, 2009 10:32 am 
Beginner
Beginner

Joined: Wed Jul 09, 2008 5:34 am
Posts: 41
Location: Brno, Czech Republic
What's the actual code you are using to test?


Top
 Profile  
 
 Post subject: Re: Committed update is not applied to already loaded object
PostPosted: Fri Sep 25, 2009 1:39 pm 
Newbie

Joined: Thu Oct 25, 2007 9:39 pm
Posts: 7
Not sure how useful the code will be. I want to know if the observed behavior is expected or not. When an object is already loaded in Hibenate session cache, any updates to this object outside the transaction does not seem to be reflected in this transaction.

Get object:
Criteria criteria = session.createCriteria(MyObject.class)
.add(Restrictions.eq("id", 123));
criteria.uniqueResult();

The update is done externally (outside of Java) using PostgreSQL client.


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.