public final class JDBCJBossQLQuery extends JDBCAbstractQueryCommand {
public JDBCJBossQLQuery(JDBCStoreManager manager, JDBCQueryMetaData q) {
super(manager, q);
JDBCJBossQLQueryMetaData metadata = (JDBCJBossQLQueryMetaData) q;
if (getLog().isDebugEnabled()) {
getLog().debug("JBossQL: " + metadata.getJBossQL());
}
QLCompiler compiler = JDBCQueryManager.getInstance(metadata.getQLCompilerClass(), manager.getCatalog());
try {
compiler.compileJBossQL(
metadata.getJBossQL(),
metadata.getMethod().getReturnType(),
metadata.getMethod().getParameterTypes(),
metadata);
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException("Error compiling JBossQL " +
"statement '" + metadata.getJBossQL() + "'", t);
}
setSQL(compiler.getSQL());
setOffsetParam(compiler.getOffsetParam());
setOffsetValue(compiler.getOffsetValue());
setLimitParam(compiler.getLimitParam());
setLimitValue(compiler.getLimitValue());
// 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