public final class JDBCEJBQLQuery extends JDBCAbstractQueryCommand {
public JDBCEJBQLQuery(JDBCStoreManager manager, JDBCQueryMetaData q) {
super(manager, q);
JDBCQlQueryMetaData metadata = (JDBCQlQueryMetaData) q;
if (getLog().isDebugEnabled()) {
getLog().debug("EJB-QL: " + metadata.getEjbQl());
}
QLCompiler compiler = JDBCQueryManager.getInstance(metadata.getQLCompilerClass(), manager.getCatalog());
try {
compiler.compileEJBQL(
metadata.getEjbQl(),
metadata.getMethod().getReturnType(),
metadata.getMethod().getParameterTypes(),
metadata);
} catch (Throwable t) {
log.error(t.getMessage(), t);
throw new RuntimeException("Error compiling EJB-QL statement for EJB '" +
manager.getComponent().getComponentName() + "': " + metadata.getEjbQl(), t);
}
setSQL(compiler.getSQL());
// set select object
if (compiler.isSelectEntity()) {
JDBCEntityBridge selectEntity = (JDBCEntityBridge) compiler.getSelectEntity();
// set the select entity
setSelectEntity(selectEntity);
// set the preload fields
JDBCReadAheadMetaData readahead = metadata.getReadAhead();
if (readahead.isOnFind()) {
setEagerLoadGroup(readahead.getEagerLoadGroup());
setOnFindCMRList(compiler.getLeftJoinCMRList());
// exclude non-searchable columns if distinct is used