-->
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.  [ 1 post ] 
Author Message
 Post subject: Session.find() pull associated objects from DB?
PostPosted: Thu Aug 03, 2006 11:16 am 
Newbie

Joined: Tue Jun 13, 2006 9:03 am
Posts: 18
I have an issue with the session.find() method that I'm not sure how to fix. In my application, I have Object_A and Object_A_Association. They are mapped to their respective tables TABLE_A and TABLE_A_ASSOC. The mapping doc for Object_A_Association is straightforward and the mapping_doc for Object_A has an association with the Object_A_Association, i.e.:
Code:
      <set name="assoc" outer-join="true" lazy="false" cascade="none">
         <key column="object_a_id" />
         <one-to-many class="object_a_association" />
      </set>


In two separate transactions (but one unit of work), I do this:

1) session.saveOrUpdate(Object_A_Association)
2) session.find(Object_A)

After I do a find and call "object_a.getAssoc()", I get old data. After going through the hibernate docs, I realize that the session.find() retrieves object_a directly from the database, but retrieves the object_a_association from the cache. And because the saveOrUpdate persists my association into the DB and not cache, my data read is incorrect. Any suggestions on how to fix the bad read? Thanks!

-nefi[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.