-->
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: What class to evict from second level cache
PostPosted: Thu Dec 18, 2008 12:11 pm 
Newbie

Joined: Fri Jun 16, 2006 9:59 am
Posts: 11
Hello,

I'm using hibernate 3.3.1 with the coherence cache.

I've got an abstract class which has multiple concrete subclasses (only the first concrete subclass has been shown here).

Code:
<class name="First" entity-name="First" table="first_table">
   <cache usage="read-write" />
   <id name="id" type="long" column="first_table_id">
      <generator class="sequence">
         <param name="sequence">first_table_seq</param>
      </generator>
   </id>

   <property name="type" type="string" column="type" />



   <joined-subclass name="Second" entity-name="Second" table="second">
      <key column="first_table_id" on-delete="cascade" />

      <property name="someField" type="long" column="some_field" />
      <property name="created" type="timestamp" column="create_date_ts" />
   </joined-subclass>
</class>


This works great, however I am unsure as to how I should evict the class I have from the second level cache. In my coherence mapping file, I only have the class First listed, not the Second class. If this is wrong, please say something. I had assumed the super class would be able to take care of all subclasses.

With that being said, if I had an instance of Second that I would like to evict, can I do this:

Code:
sessionFactory.evict(First.class,id);


or do I need to evict on Second like so:

Code:
sessionFactory.evict(Second.class,id);


I've been looking around and cannot seem to figure out what needs done. Neither case returns an error, so I'm not sure what to do. It is not an option to change the mapping file unless I need to as a last resort.

Thanks


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.