Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

fetching records by using hql and criteria is taking more time  RSS feed

vijay akni kumar
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have a hql 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("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 ................
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!