* or just returns an existing one.
* @param qd a QueryDefinition
* @return a (new/existing) CompiledQuery instance.
*/
public synchronized CompiledQuery getQueryCompiler(QueryDefinition qd) {
CompiledQuery cq = (CompiledQuery) compiledQueriesCache.lookup(qd);
if (cq == null) {
if (logger.isLoggable(BasicLevel.DEBUG)) {
logger.log(BasicLevel.DEBUG, "Allocation of a new compiled query: "
+ qd.qdToString(false));
}
cq = createCompileQuery(qd);
qd.withPrefetch(prefetchingOnExtent && qd.withPrefetch());
try {
compiledQueriesCache.bind(cq.getCeIdentifier(), cq);
} catch (CacheException e) {
logger.log(BasicLevel.WARN,
"Impossible to bind a new compiled query from the cache: ", e);
//nothing to do, the compiled query is not cached
}