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 snippet below.
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.
For hibernate performance tuning we have options like fetch size. You can refer following link https://vladmihalcea.com/hibernate-performance-tuning-tips/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.