{
super(manager, q);
this.manager = manager;
rowLocking = manager.getMetaData().hasRowLocking();
JDBCEntityBridge entity = (JDBCEntityBridge) manager.getEntityBridge();
JDBCTypeMappingMetaData typeMapping = this.manager.getJDBCTypeFactory().getTypeMapping();
AliasManager aliasManager = new AliasManager(
typeMapping.getAliasHeaderPrefix(),
typeMapping.getAliasHeaderSuffix(),
typeMapping.getAliasMaxLength()
);
String alias = aliasManager.getAlias(entity.getEntityName());
StringBuffer select = new StringBuffer(200);
SQLUtil.getColumnNamesClause(entity.getPrimaryKeyFields(), alias, select);
StringBuffer from = new StringBuffer();
from.append(entity.getQualifiedTableName())
.append(' ')
.append(alias);
// set the preload fields
JDBCReadAheadMetaData readAhead = q.getReadAhead();
if(readAhead.isOnFind())
{
setEagerLoadGroup(readAhead.getEagerLoadGroup());
if(getEagerLoadMask() != null)
{
SQLUtil.appendColumnNamesClause(entity.getTableFields(), getEagerLoadMask(), alias, select);
List onFindCMRList = JDBCAbstractQueryCommand.getLeftJoinCMRNodes(
entity, entity.getQualifiedTableName(), readAhead.getLeftJoins(), null);
if(!onFindCMRList.isEmpty())
{
setOnFindCMRList(onFindCMRList);
JDBCAbstractQueryCommand.leftJoinCMRNodes(alias, onFindCMRList, aliasManager, from);
JDBCAbstractQueryCommand.appendLeftJoinCMRColumnNames(onFindCMRList, aliasManager, select);
}
}
}
StringBuffer where = new StringBuffer();
SQLUtil.getWhereClause(entity.getPrimaryKeyFields(), alias, where);
// generate the sql
StringBuffer sql = new StringBuffer(300);
if(rowLocking && readAhead.isOnFind() && getEagerLoadMask() != null)
{