-->
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: Implementation of criterion in hibernate 3.6.3
PostPosted: Fri Jul 01, 2011 10:29 am 
Newbie

Joined: Wed Jun 29, 2011 5:50 am
Posts: 3
HI!
this a sample of a code in hibernate 2 :

public List findAllByCommercialElement(CommercialElement commercialElement)
throws GCETechnicalException {
return GCEHibernateHelper.findAllByCriterion(
CommEltRTCToNetworkEltRTC.class, "commercialElement",
commercialElement, Hibernate.entity(commercialElement
.getClass()));
}
After upgrade to hibernate 3.6.3, the method "entity"( entity(commercialElement.getClass()))) is deprecated. Further more, performance tests show that all methods that call "findAllByCriterion" are at least two more slow in hibernate 3.6.3

Question : is someone know how to good implement methods with Criteria ? Actually this is how is it :
try {
Criteria crit = session.createCriteria(searchClass);
crit.add(Expression.eq(searchProperty, searchValue));
crit.setCacheable(true);

if (rownum > 0) crit.setMaxResults(rownum);

return crit.list();

}
catch (HibernateException he) {
throw new GCETechnicalException(GCETechnicalException.QUERY_ERROR, "GCEHibernateHelper.findAllByCriterion", he);
}
HELP ?


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.