[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6979) QueryPlanCache is not used in an optimal way

Jan Stolze (JIRA) noreply at atlassian.com
Tue Jan 17 08:25:13 EST 2012


QueryPlanCache is not used in an optimal way
--------------------------------------------

                 Key: HHH-6979
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6979
             Project: Hibernate ORM
          Issue Type: Bug
    Affects Versions: 3.6.1
            Reporter: Jan Stolze
            Priority: Critical
         Attachments: FlushAndTransactionTest.java

The criteria query uses the HQLQueryPlan in order to speed things up unfortunately it uses poor keys to do so. That is it resolves various parameters in the query which is used as cache key.
An example: the query select id, name from book where id=? should be used as key for the cache. 
But instead of this it uses: select id, name from book where id=1
So the next time this query is executed with id=2 it will not be found in the QueryPlanCache which results in the creation of a new HQLQueryPlan this is not very efficient I would say.

This problem can be seen when executing the FlushAndTransactionTest#testNoCache method and adding a breakpoint on SessionImpl#list(String query, QueryParameters queryParameters) method. The supplied query is not what I expect select id, name from book where id:= param1 but select id, name from book where id=1, or 2 etc.
This query argument is used for retrieving the HQLQueryPlan from the QueryPlanCache.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list