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: fetching records by using hql and criteria is taking more
PostPosted: Tue Mar 31, 2009 4:41 am 
Newbie

Joined: Fri Dec 26, 2008 6:01 am
Posts: 6
Hi All
I have a query , when ever i iam getting 400 -500 records it is taking 3-4 sec. but when iam getting around 5000 record it is taking more time around 3 min in local system.

the method is
public List getAllSourcedCandiadtes(String startingDate, String endingDate) {

return (List) getHibernateTemplate().find(

"select distinct prospectiveCandidates from ProspectiveCandidates prospectiveCandidates where prospectiveCandidates.appliedDate between '" + startingDate + "' and '" + endingDate + "' and (prospectiveCandidates.sourceName != 'candidate' ) and (prospectiveCandidates.sourceResume !=null )");
}

the query is working fine but I want to improve the performance, even i tried using criteria API
Criteria crit = session.createCriteria(ProspectiveCandidates.class)
.add(Expression.between("appliedDate", new Date(startDate.getTime()),new Date(endDate.getTime())));

crit.add(Restrictions.and(Restrictions.ne("sourceName","candidate"), Restrictions.isNotNull("sourceResume")));

List abcd= crit.list();

return abcd;

I am able to get records with criteria API but iam not able to improve the performance.
please suggest me ................


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.