Hi,
I am using Hibernate 2.1.3 in my J2EE application in JBoss-3.2.3.
I have the following hbm mappings. I have enabled second level cache and mentioned cache-usage as transactional in the hbms:
Code:
<hibernate-mapping>
<class
name="com.dbdata.processingengine.hibernateobject.CrProcessingEngine"
table="CR_PROCESSING_ENGINE"
>
<cache usage="transactional"/>
......
<set
name="crExecutionLists"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
>
<cache usage="transactional"/>
<key
>
<column
name="PROCESSING_ENGINE_ID"
/>
<column
name="PROCESSING_ENGINE_VERSION_ID"
/>
</key>
<one-to-many
class="com.dbdata.processingengine.hibernateobject.CrExecutionList"
/>
</set>
</hibernate-mapping>
Code:
<hibernate-mapping>
<class
name="com.dbdata.processingengine.hibernateobject.CrExecutionList"
table="CR_EXECUTION_LIST"
>
<cache usage="transactional"/>
</hibernate-mapping>
When i fire HQLs as follows:
Code:
from CrProcessingEngine as obj where obj.id = 500;
then the object that is retrieved(along with the collection) gets cached in the second level cache as expected.
But, when execute the following query:
Code:
from CrProcessingEngine as obj inner join fetch obj.crExecutionLists where obj.id = 500
then NONE of the objects get cached in the second-level cache.
Does anyone know the reason for the same?
Thank you.