if (NucleusLogger.QUERY.isDebugEnabled())
{
startTime = System.currentTimeMillis();
NucleusLogger.QUERY.debug(LOCALISER.msg("021044", "JPQL", getSingleStringQuery()));
}
JavaQueryCompiler compiler = new JPQLCompiler(om.getMetaDataManager(), om.getClassLoaderResolver(),
from, candidateClass, candidateCollection,
this.filter, getParsedImports(), this.ordering, this.result, this.grouping, this.having,
explicitParameters, update);
compilation = compiler.compile(parameterValues, subqueries);
if (QueryUtils.queryReturnsSingleRow(this))
{
compilation.setReturnsSingleRow();
}
if (compilation.getExprResult() == null)
{
// If the result was "Object(e)" or "e" then this is meaningless so remove
result = null;
}
if (NucleusLogger.QUERY.isDebugEnabled())
{
NucleusLogger.QUERY.debug(LOCALISER.msg("021045", "JPQL",
"" + (System.currentTimeMillis() - startTime)));
}
if (subqueries != null)
{
// Compile any subqueries
Iterator iter = subqueries.entrySet().iterator();
while (iter.hasNext())
{
Map.Entry entry = (Map.Entry)iter.next();
SubqueryDefinition subqueryDefinition = (SubqueryDefinition)entry.getValue();
Query subquery = subqueryDefinition.getQuery();
if (NucleusLogger.QUERY.isDebugEnabled())
{
startTime = System.currentTimeMillis();
NucleusLogger.QUERY.debug(LOCALISER.msg("021044", "JPQL",
((AbstractJPQLQuery)subquery).getSingleStringQuery()));
}
compiler = new JPQLCompiler(om.getMetaDataManager(), om.getClassLoaderResolver(),
subquery.from, subquery.candidateClass, null,
subquery.filter, getParsedImports(), subquery.ordering, subquery.result,
subquery.grouping, subquery.having, null, null);
QueryCompilation subqueryCompilation = compiler.compile(parameterValues, null);
compilation.addSubqueryCompilation((String)entry.getKey(), subqueryCompilation);
if (NucleusLogger.QUERY.isDebugEnabled())
{
NucleusLogger.QUERY.debug(LOCALISER.msg("021045", "JPQL",
"" + (System.currentTimeMillis() - startTime)));