Cache not working for joined subclass

Problem:
I am using the Joined Subclass inheritance structure (https://docs.jboss.org/hibernate/stable/orm/userguide/html_single/Hibernate_User_Guide.html#entity-inheritance-joined-table). 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

First, you need to replicate the issue with this test case template.

After you have the test case, you can open a new Jira issue.

1 Like

first time doing this, let me know if needs any changes.

@mekane You can create a zip file with the project and open a Jira issue with it.

1 Like

If anyone else has similar problems, I created a JIRA issue here:

https://hibernate.atlassian.net/browse/HHH-13173

I have the same issue as
https://hibernate.atlassian.net/browse/HHH-13173

Does anyone know when we can get this issue fixed? And is there any workaround? Thanks