updateInverse(sm, rel, store, rm);
} else {
int action = (rel == null &&
field.isBidirectionalJoinTableMappingNonOwner()) ?
Row.ACTION_DELETE : Row.ACTION_UPDATE;
Row row = field.getRow(sm, store, rm, action);
if (row != null && !field.isBiMTo1JT()) {
field.setForeignKey(row, rel);
// this is for bi-directional maps, the key and value of the
// map are stored in the table of the mapped-by entity
setMapKey(sm, rel, store, row);
}
if (field.isBiMTo1JT()) { // also need to update the join table
PersistenceCapable invPC = (PersistenceCapable)sm.fetchObject(
field.getBi_1ToM_JTField().getIndex());
Row secondaryRow = null;
if (invPC != null) {
secondaryRow = rm.getSecondaryRow(field.getBi1ToMJoinFK().getTable(),
Row.ACTION_INSERT);
secondaryRow.setForeignKey(field.getBi1ToMElemFK(), null, sm);
secondaryRow.setForeignKey(field.getBi1ToMJoinFK(), null,
RelationStrategies.getStateManager(invPC,
store.getContext()));
rm.flushSecondaryRow(secondaryRow);
}
}