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