views:

50

answers:

0

I am trying optimize my code. I fetching the data using hibernate, when i am running the query directly on the database it fetching the results in 2secs, rowcount around 2800. Same query when i fire from my java code takes 8 secs. i have included the code sniplet below. Please help me out on this, its very urgent.

Session hSession =openSession();
Query query = hsession.createSQLQuery(searchString); 
List results = query.list(); // it takes 7 secs to execute

I am not sure what is wrong over here.