// First try to get Expression directly.
try {
return new QueryImpl(this, new CodeParser((Class) query));
} catch (Throwable e) {
// Code could not be turned into JDOQL.
return new CodeQuery(this, (Class) query);
}
}
throw new UnsupportedOperationException();
}