}
if (hasCustomInsertQuery()) {
return;
}
SQLInsertStatement statement = new SQLInsertStatement();
statement.setTable(getRelationTable());
AbstractRecord joinRow = new DatabaseRecord();
for (Enumeration targetEnum = getTargetRelationKeyFields().elements();
targetEnum.hasMoreElements();) {
joinRow.put((DatabaseField)targetEnum.nextElement(), null);
}
for (Enumeration sourceEnum = getSourceRelationKeyFields().elements();
sourceEnum.hasMoreElements();) {
joinRow.put((DatabaseField)sourceEnum.nextElement(), 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);
}