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: Strange problem in query that is preceeded by an update
PostPosted: Wed Jun 27, 2007 5:37 pm 
Newbie

Joined: Wed Jun 27, 2007 5:09 pm
Posts: 7
Hibernate version:
Hibernate 3.2.1


Name and version of the database you are using:
Oracle 10g

I perform the following operations:

Service method callA()
1) load a object using session -
User user1 = session.get(User.class, id);

2) Modify some values
user1.setLastName("Rxxxxx");
session.update(user1);

Service method callB()
1) Retrive users
Criteria criteria =session.createCriteria(User.class);
//set the criteria
List<User> userList = criteria.list();

The userList above contains modified user in callA() - i.e user1. Going through "userList" using debugger I find that all instances in the list are initialized properly except modified user in callA(). The id field of user1 is initialized correctly but fields like firstName, lastName etc are null.

As a result when I display the list of users in the JSP page, some attributes of user1 are displayed as null. When I request for user listing (i.e service callB() only) they all get displayed correctly.

What's going on ?

I'm using Spring transaction mgmt/ OpenSessionViewFilter and lazy loading. Service callA() and callB() are part of the same request.

Can someone please help. This is urgent.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 3:24 am 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
read the reference


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 28, 2007 10:00 am 
Newbie

Joined: Wed Jun 27, 2007 5:09 pm
Posts: 7
dilembo wrote:
read the reference


The hibernate reference doc is huge. If you think I'm missing something can you please point me to the correct reference.

Thanks.


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.