-->
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: class mapped by subselect within a tranaction
PostPosted: Fri Feb 15, 2008 2:41 am 
Newbie

Joined: Fri Feb 15, 2008 1:57 am
Posts: 2
Hibernate version: 3.1.3

I have a class, say Class1, mapped from "subselect". The "subselect" contains a SQL query that join two tables, say table1 and table2.

I have another class, say Class1_1, mapped to table1.

In a dao method, I update Class1_1 first and then do a get() for Class1 with Class1_1's id, the returned Class1 from the get() contains the old values of Class1_1 instead of the updated values.

I have show sql turned on it looks like the update() is executed after the "select" even though my code has "update" followed by "select".

Any ideas?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 4:35 pm 
Newbie

Joined: Fri Feb 15, 2008 1:57 am
Posts: 2
I have it figured out.

When using spring's hibernate template, if you dont for flush, hibernate will decide when to send sql command to dabase. If you need to see the change in db immediately, call flush manuall.


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.