/**
* Map this field to its table, optionally requiring that it be
* in another table. Utility method for use by mapping strategies.
*/
public void mapJoin(boolean adapt, boolean joinRequired) {
Table table = _info.getTable(this, joinRequired, adapt);
if(table != null && table.equals(getDefiningMapping().getTable())) {
// Don't create a join if the field's table is the same as the
// class's table.
table = null;
}
ForeignKey join = null;
if (table != null)
join = _info.getJoin(this, table, adapt);
if (join == null && joinRequired)
throw new MetaDataException(_loc.get("join-required", this));
if (join == null) {
_info.assertNoJoin(this, true);
_info.assertNoForeignKey(this, !adapt);
_info.assertNoUnique(this, !adapt);
_info.assertNoIndex(this, !adapt);
} else {
_fk = join;
_io = _info.getColumnIO();
_outer = _info.isJoinOuter();
_unq = _info.getJoinUnique(this, false, adapt);
_joinTableUniques = _info.getJoinTableUniques(this, false, adapt);
_idx = _info.getJoinIndex(this, adapt);
table.setAssociation();
}
}