Hi all,
I recently join a new application team developpers and noticed some strange behaviors about the persistence layer of their application.
Is there any reason or any particular hibernate configuration that explains the more a simple (w\o any eargly fetched data) select query is repeatedly executed the more time is execution takes.
Here is a example of HQL query :
Code:
final StringBuilder sb = new StringBuilder();
sb.append("From ");
sb.append(classe.getSimpleName());
sb.append(" as o where o.idNode = :idNode and idParam = :idParam");
final Query qry = getHibernateUtil().getHibernateSession().createQuery(sb.toString());
qry.setParameter("idNode", idNode);
qry.setParameter("idParam", idParam);
return (AnObject) qry.uniqueResult();
and the issuing SQL query :
Code:
select
this_.id as id69_0_,
this_.node_id as noeuds2_69_0_,
this_.droits_id as droits3_69_0_,
this_.fonctions_id as fonctions4_69_0_,
this_.param_id as id5_69_0_,
this_.niveau as niveau69_0_
from
fonction_droits this_
where
this_.node_id=?
and
this_.param_id=?
In a test when I place this query into a loop from 1 to 6500 iterations and add timers its execution time is multiplied by 4 between the 1000 first iterations and the 1000 last ones (the average execution time increase from 7ms to 28ms).
The test is executed with a single session and a single transaction.
The query parameters are chosen to return any object so it should not be a matter of objects instanciation.
I already tried the same test with a direct JDBC connection resulting with a negligible execution time so this is not a database (Oracle) issue.
We also use a C3P0 connections pool that I tried to bypass but the result is the same.
This is probably due to a bad configuration but I can't figure it out.
Many thanks in advance for your highlights.