Problem:
I am using the Joined Subclass inheritance structure (Hibernate ORM User Guide). I am trying to use a read-write cache strategy. The 2nd level caching does not seem to work for this joined subclass inheritance structure. I am using hibernate xml mapping.
uiowa.hawkirb.biz.person.Person is abstract class.
<class name=“uiowa.hawkirb.biz.person.Person” table=“PERSON”>
<cache usage=“read-write”/>
<id name=“OID” column=“PERSON_ID” type=“long” unsaved-value=“null”>
<generator class=“sequence”>
<param name=“sequence_name”>HAWKIRB_SEQ</param>
</generator>
</id>
<property name=“email” column=“EMAIL” type=“string”/>
<joined-subclass name=“uiowa.hawkirb.biz.person.UIPerson” table=“UI_PERSON”>
<key column=“PERSON_ID”/>
<property name=“universityId” column=“UNIVID” type=“string”/>
</joined-subclass>
<joined-subclass name=“uiowa.hawkirb.biz.person.NonUIPerson” table=“NON_UI_PERSON”>
<key column=“PERSON_ID”/>
<property name=“institutionName” column=“INST_NAME” type=“string”/>
</joined-subclass>
</class>
It looks like it’s creating the caching region named after the super class (“uiowa.hawkirb.biz.person.Person”) but it doesn’t want to do puts into the cache because it’s using the subclass name (“uiowa.hawkirb.biz.person.UIPerson”) and determining that there is no cache for this item
Specs:
jcache
org.ehcache.jsr107.EhcacheCachingProvider
ehcache-3.6.1
hibernate-5.3.7