protected String generateTableAlias(int n,
String path,
Joinable joinable) {
if ( joinable.consumesEntityAlias() ) {
final Criteria subcriteria = translator.getCriteria(path);
String sqlAlias = subcriteria==null ? null : translator.getSQLAlias(subcriteria);
if (sqlAlias!=null) {
userAliasList.add( subcriteria.getAlias() ); //alias may be null
return sqlAlias; //EARLY EXIT
}
else {
userAliasList.add(null);
}
}
return super.generateTableAlias( n + translator.getSQLAliasCount(), path, joinable );
}
|
protected int getJoinType(AssociationType type,
FetchMode config,
String path,
String lhsTable,
String[] lhsColumns,
boolean nullable,
int currentDepth,
CascadeStyle cascadeStyle) throws MappingException {
if ( translator.isJoin(path) ) {
return translator.getJoinType( path );
}
else {
if ( translator.hasProjection() ) {
return -1;
}
else {
FetchMode fetchMode = translator.getRootCriteria()
.getFetchMode(path);
if ( isDefaultFetchMode(fetchMode) ) {
return super.getJoinType(
type,
config,
path,
lhsTable,
lhsColumns,
nullable,
currentDepth, cascadeStyle
);
}
else {
if ( fetchMode==FetchMode.JOIN ) {
isDuplicateAssociation(lhsTable, lhsColumns, type); //deliberately ignore return value!
return getJoinType(nullable, currentDepth);
}
else {
return -1;
}
}
}
}
}
|