After a few same hql query the application freezes
Posted
by
Oktay
on Stack Overflow
See other posts from Stack Overflow
or by Oktay
Published on 2011-06-21T14:11:43Z
Indexed on
2011/06/21
16:22 UTC
Read the original article
Hit count: 172
I am calling below function with the same batchNumber and it is working without problem 15 times and takes the records fromm database without problem but at 16. time the application freezes when the query.list() row is called. It just loses debug focus and not give any exception. This problem probably is not about the hql because I've seen this problem before and I used criteria instead of hql and I got pass this problem. But for this when I use "group by" in criteria(setrojection....) it doesn't return the result as hibernate model(object) just returns a list. But I need the results as model.
Note: about 15 times it is just for test. This is a web aplication and user may click the button many times that calls this funtion to see the taken records from database.
public List<SiteAddressModel> getSitesByBatch(String batchNumber) {
try{
List<SiteAddressModel> siteList;
MigrationPlanDao migrationPlanDao = ServiceFactory.getO2SiteService().getMigrationPlanDao();
Query query = this.getSession().createQuery("from " + persistentClass.getName() + " where " + "siteType =:" + "type and siteName in " +
"(select distinct exchange from " + migrationPlanDao.getPersistentClass().getName() +
" where migrationBatchNumber =:" + "batchNumber" + ")"
);
query.setString("batchNumber", batchNumber);
query.setString("type", "LLU/ASN");
System.out.println("before query");
siteList = query.list();
System.out.println("after query");
return siteList;
}catch (Exception e) {
e.printStackTrace();
}
Hibernate version 3.2.0.ga
© Stack Overflow or respective owner