Map<String, Object> fields = FastMap.newInstance();
for (int i = 0; i < relation.getKeyMapsSize(); i++) {
ModelKeyMap keyMap = relation.getKeyMap(i);
fields.put(keyMap.getRelFieldName(), this.get(keyMap.getFieldName()));
}
EntityFieldMap ecl = EntityCondition.makeCondition(fields);
long count = this.getDelegator().findCountByCondition(relation.getRelEntityName(), ecl, null, null);
if (count == 0) {
if (insertDummy) {
// create the new related value (dummy)
GenericValue newValue = this.getDelegator().makeValue(relation.getRelEntityName());