-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate query caching does not fetch many-to-one records
PostPosted: Wed Jan 17, 2007 9:58 am 
Newbie

Joined: Wed Jan 17, 2007 9:12 am
Posts: 1
Hello,

My name is Sabeeh. I am currently working on an application which uses hibernate at back end for retrieving records from the DB.

The problem is that when I try to fetch records using query catching the many-to-one records are not cached in the record set.

e.g.

I am using the following HQL

Query query = session.createQuery("from com.salesgene.common.bean.hibernate.Task as task left join fetch task.employeeByAssignee");

query.setCacheRegion("Task");
query.setCacheable(true);
query.list();


My Task.xml file is as follows

-----------------------------------------------------------------------

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
<class
name="com.salesgene.common.bean.hibernate.Task"
table="TASK"
>

<cache
usage="read-write"
region="Task"
/>

<many-to-one
name="employeeByAssignee"
class="com.salesgene.common.bean.hibernate.Employee"
not-null="false"
fetch="join"
>
<column name="ASSIGNEE" />
</many-to-one>
</class>
</hibernate-mapping>

-----------------------------------------------------------------------

In query.list(); it gives me all the records related to Task but does not gives the employeeByAssignee records. Can anyone please tell me how to cache <many-to-one> records using query caching.

Any help in this regard will be highly appreciated.

Many thanks and regards,

Sabeeh


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

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.