In my project , I am doing search on certain parameters using hibernate criteria query. But to return 300-400 records in soap response(after some small processing logic applied) its taking around 9-10 mins in eclipse junit test case.
After enabling logging level to trace , I observed same query sometimes executes 2 times or sometimes 3 times (This might be the issue but I am not understanding it it's the reason).
e.g.
select * from ( select this.id as _id.....
select * from ( select this.id as _id.....
select * from ( select this.id as _id.....
To fix this performance issue ,I CANNOT change anything in the DB entities and their relation.
Wanted to check if I can do anything in hibernate criteria query only to improve the performance.
Below code is used while doing search .I am doubting on below code .Just for analyzing I commented below code and executed junit but still there is no improvement in the performance.
criteria.setResultTransformer(CRITERIA_DISTINCT_ENTITY);
criteria.createAlias("name","name",CriteriaSpecification.LEFT_JOIN);
criteria.createorder(..);
Can anybody suggest what I can do to improve criteria query performance.