-->
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: optimalization of fetching
PostPosted: Tue Mar 21, 2006 6:52 am 
Newbie

Joined: Tue Mar 21, 2006 5:22 am
Posts: 5
Hi all,
I have the following mapping:
<class name="com.pjuza.oncology.domain.Parameter" table="parameters">
<cache usage="nonstrict-read-write"/>
<id name="id" column="param_id">
<generator class="increment"/>
</id>
<discriminator column="type" type="string"/>
<property name="name" column="name" not-null="true" />
<subclass name="com.pjuza.oncology.domain.LocalizationParam" discriminator-value="1"/>
<subclass name="com.pjuza.oncology.domain.OrganParam" discriminator-value="2"/>
<subclass name="com.pjuza.oncology.domain.PictureObjectParam" discriminator-value="3"/>
<subclass name="com.pjuza.oncology.domain.TreatmentParam" discriminator-value="4"/>
<subclass name="com.pjuza.oncology.domain.PictureTypeParam" discriminator-value="5"/>
</class>.


Generally these parameters are changed very seldom and there are fetched very often. Thus I would like to optimalize fetching of them because now I see five SELECT queries everytime I need them.

I use this function for loading objects (from Spring):
public List loadAll(final Class entityClass) throws DataAccessException {
return (List) execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
Criteria criteria = session.createCriteria(entityClass);
prepareCriteria(criteria);
return criteria.list();
}
}, true);
}

I use "standard" Hibernate installation without special configuration - I thought that Hibernate use cache by default... I'm not able to force Hibernate to cache it.

Thank you very much.
PETER


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.