getInsertQuery().setName(mapping.getAttributeName());
if (hasCustomInsertQuery()) {
return;
}
SQLInsertStatement statement = new SQLInsertStatement();
statement.setTable(getRelationTable());
AbstractRecord joinRow = new DatabaseRecord();
for (DatabaseField field : getTargetRelationKeyFields()) {
joinRow.put(field, null);
}
for (DatabaseField field : getSourceRelationKeyFields()) {
joinRow.put(field, null);
}
if (mapping.isCollectionMapping()) {
CollectionMapping collectionMapping = (CollectionMapping)mapping;
if (collectionMapping.getListOrderField() != null) {
joinRow.put(collectionMapping.getListOrderField(), null);
}
collectionMapping.getContainerPolicy().addFieldsForMapKey(joinRow);
}
statement.setModifyRow(joinRow);
getInsertQuery().setSQLStatement(statement);
getInsertQuery().setModifyRow(joinRow);
}