It appears the the criteriaBuilder.literal() is not treated as literal
consistently during generation of HQL / SQL.

For criteria queries, the HQL (OpenJPAQuery.getQueryString())  is generated
as what I would consider proper HQL in that parameters are :prefixed and
literals are hard valued within the query. eg: (SELECT sample, sample2 FROM
table WHERE sample=:parameter AND sample2='literal value'; )

When the sql is generated however, both via :
OpenJPAQuery.getDataStoreActions(parm)[0] the paramaters (other than data
parameters) are directly substituted (eg: SELECT sample, sample2 FROM table
WHERE sample='paramter value' AND sample2='literal')

When the query is actually performed however, via logging I see that
everything is treated as a parameter. (SELECT sample, sample2 FROM table
WHERE sample=:parameter AND sample2=:sample2 ).

This is an issue as when dealing with partitioned tables Postgres is unable
to perform a valid query plan without the associated values on the column
that we have partitioned on.   Running this from within OpenJPA 2.2.0 and
OpenJPA 2.2.2 yield the same results.   I believe that this is an attempt
to help the database cache query plans yet this optimization is actually
causing a major performance problem.

Suggestions?

-- 
-------------------------------------------
Craig Taylor
ctalk...@ctalkobt.net

Reply via email to