After much struggle , I finally found a workaround: the issue disappears when mappings in hibernate.cfg.xml are ordered from base class to subclass:
<!-- "Right" way --> <mapping resource="BaseClass.hbm.xml" /> <mapping resource="SubClass.hbm.xml" /> <class-cache class="com.example.BaseClass"/> <collection-cache collection="com.example.SubClass.items"/>
<!-- "Wrong" way --> <mapping resource="SubClass.hbm.xml" /> <mapping resource="BaseClass.hbm.xml" /> <class-cache class="com.example.BaseClass"/> <collection-cache collection="com.example.SubClass.items"/>
Tested with hibernate-4.1.3.Final
After much struggle , I finally found a workaround: the issue disappears when mappings in hibernate.cfg.xml are ordered from base class to subclass:
Tested with hibernate-4.1.3.Final