-->
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: Second Lvl Cache not updated with Flush
PostPosted: Wed Jul 19, 2006 5:10 pm 
Newbie

Joined: Wed May 17, 2006 3:45 pm
Posts: 4
Using Hibernate 3:

I have a Project class that has a set of Vendor classes. I've enabled second level cache (I'm using the default Hashtable cache) and that takes care of caching the project and its set of vendors each time I get them from the database. This all works great...

However, when I save a new vendor [session.save(vendor)] and call flush(), the cache for project's collection of vendors is not being cleared or updated with the new vendor that was just saved.
Code:
<class name="Project">
  <cache usage="read-write"/>

  <set cascade="delete"
   name="vendors"
   lazy="true"
   inverse="true">
   <cache usage="read-write"/>
     <key column="PROJECT_ID" />
     <one-to-many class="Vendor" />
  </set>
</class>

<class name="Vendor" >
  <cache usage="read-write"/>
  <many-to-one name="project" cascade="none"
         class="Project" not-null="true">
         <column name="PROJECT_ID" />
  </many-to-one>
</class>


I can call evictCollection() to remove the cache of vendors from the Project and this works, however I don't want to manually call evict every time I need to save/delete a new item in a collection on a Project. A flush() should take care of this... anyone know what I am missing? Thanks in advance!


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.