-->
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: why is my cache faster the hibernate's cache on criteria?
PostPosted: Wed Aug 27, 2008 4:31 pm 
Newbie

Joined: Wed Aug 27, 2008 4:21 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.7c

final AbstractCacheCommand c= new AbstractCacheCommand(session,CacheUtils.getTaskDefCache()){
protected CachebleBo getNewObject(Serializable[] key) throws ApplicationException {
try {
final Example example = Example.create(bo);

final Criteria createCriteria = createCriteria(TaskDefBo.class);
final Criteria add = createCriteria.add(example);
add.setCacheable(true);
add.setCacheRegion(TaskDefBo.class.getName());
CachebleList cachebleList=new CachebleList(add.list());
return cachebleList;
} catch (HibernateException e) {
throw new ApplicationException("Error getting TaskDefBo by filter definition");
}
}
};

Name and version of the database you are using: oracle 10g


hi all, i'm using the code above as my own cache management, the AbstractCacheCommand, simply gets a key checks to see if it exists in the cahce otherwise ith executes the code in the callback method.

but i don't want to do that, i want hibernate to do it for me, but for some reasons it's much slower then my own implementation, maybe becouse it's a flush in the session when i do the list method.

i'm using ehcache 1.2.3
for reasons i won't go into, i'm using the ehcache.xml in it's default configuration, meaning the each class gets it's region from the default settings, does that matter? i'm doing the same with my cache.


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.