/** * We can use an inner join for first many-to-many association */ protected int getJoinType( AssociationType type, FetchMode config, String path, Set visitedAssociations, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth) throws MappingException { int joinType = super.getJoinType( type, config, path, visitedAssociations, lhsTable, lhsColumns, nullable, currentDepth ); //we can use an inner join for the many-to-many if ( joinType==JoinFragment.LEFT_OUTER_JOIN && "".equals(path) ) { joinType=JoinFragment.INNER_JOIN; } return joinType; }
/** * Uniquely identifier a foreign key, so that we don't * join it more than once, and create circularities */ private static final class AssociationKey { private String[] columns; private String table; private AssociationKey(String[] columns, String table) { this.columns = columns; this.table = table; } public boolean equals(Object other) { AssociationKey that = (AssociationKey) other; return that.table.equals(table) && Arrays.equals(columns, that.columns); } public int hashCode() { return table.hashCode(); //TODO: inefficient } }
final int joinType = getJoinType( associationType, persister.getFetchMode(),
int joinType = getJoinType( associationType, persister.getFetchMode(propertyNumber),
final int joinType = getJoinType( associationType, compositeType.getFetchMode(i),
final int joinType = getJoinType( associationType, componentType.getFetchMode(i),