-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Objects fetched through HQL, NOT getting cached
PostPosted: Fri Nov 18, 2005 7:12 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 10:00 am 
Newbie

Joined: Thu Nov 17, 2005 7:06 pm
Posts: 10
Did you try to turn on query cache?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 10:11 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
No, i have NOT enabled query cache. But, if this is the reason for the objects not getting cached, then i am wondering how did it cache the object when i executed the following query:

Code:
from CrProcessingEngine as obj where obj.id = 500;


Will try out enabling the query cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.