// around an inverse key: check to see if we're mapped as a secondary
// table join but we're in the table of the related type, and if so
// switch our join mapping info to our value mapping info
DBIdentifier tableName = field.getMappingInfo().getTableIdentifier();
Table table = field.getTypeMapping().getTable();
ValueMappingInfo vinfo = field.getValueInfo();
if (!DBIdentifier.isNull(tableName) && table != null
&& (tableName.equals(table.getIdentifier())
|| tableName.equals(table.getFullIdentifier()))) {
vinfo.setJoinDirection(MappingInfo.JOIN_INVERSE);
vinfo.setColumns(field.getMappingInfo().getColumns());
field.getMappingInfo().setTableIdentifier(DBIdentifier.NULL);
field.getMappingInfo().setColumns(null);
}
if (!field.isBiMTo1JT())
field.mapJoin(adapt, false);
if (field.getTypeMapping().isMapped()) {
if (field.getMappedByIdValue() != null)
setMappedByIdColumns();
if (!field.isBiMTo1JT()) {
ForeignKey fk = vinfo.getTypeJoin(field, field.getName(), true,
adapt);
field.setForeignKey(fk);
}
field.setColumnIO(vinfo.getColumnIO());
if (vinfo.getJoinDirection() == vinfo.JOIN_INVERSE)
field.setJoinDirection(field.JOIN_INVERSE);
} else
RelationStrategies.mapRelationToUnmappedPC(field, field.getName(),
adapt);