}
}
hasOrder = collection.getOrderBy() != null;
if ( hasOrder ) {
ColumnMapper mapper = new ColumnMapper() {
public String[] map(String reference) {
return elementPropertyMapping.toColumns( reference );
}
};
sqlOrderByStringTemplate = Template.renderOrderByStringTemplate(
collection.getOrderBy(),
mapper,
factory,
dialect,
factory.getSqlFunctionRegistry()
);
}
else {
sqlOrderByStringTemplate = null;
}
// Handle any filters applied to this collection
filterHelper = new FilterHelper( collection.getFilterMap(), dialect, factory.getSqlFunctionRegistry() );
// Handle any filters applied to this collection for many-to-many
manyToManyFilterHelper = new FilterHelper( collection.getManyToManyFilterMap(), dialect, factory.getSqlFunctionRegistry() );
manyToManyWhereString = StringHelper.isNotEmpty( collection.getManyToManyWhere() ) ?
"( " + collection.getManyToManyWhere() + ")" :
null;
manyToManyWhereTemplate = manyToManyWhereString == null ?
null :
Template.renderWhereStringTemplate( manyToManyWhereString, factory.getDialect(), factory.getSqlFunctionRegistry() );
hasManyToManyOrder = collection.getManyToManyOrdering() != null;
if ( hasManyToManyOrder ) {
ColumnMapper mapper = new ColumnMapper() {
public String[] map(String reference) {
return elementPropertyMapping.toColumns( reference );
}
};
manyToManyOrderByTemplate = Template.renderOrderByStringTemplate(