@SuppressWarnings("rawtypes") public void doSecondPass(Map persistentClasses) throws MappingException { Value element = collection.getElement(); DependantValue elementDependantValue = null; String oldElementForeignKeyName = null; if(element instanceof DependantValue) { elementDependantValue = (DependantValue)element; oldElementForeignKeyName = elementDependantValue.getForeignKeyName(); elementDependantValue.setForeignKeyName("none"); // Workaround to avoid DependantValue to create foreignkey just because reference columns are not the same + no need to create keys already in the db! } Value key = collection.getKey(); DependantValue keyDependantValue = null; String oldKeyForeignKeyName = null; if (key instanceof DependantValue) { keyDependantValue = (DependantValue)key; oldKeyForeignKeyName = keyDependantValue.getForeignKeyName(); keyDependantValue.setForeignKeyName("none"); } super.doSecondPass(persistentClasses); if(elementDependantValue!=null) { elementDependantValue.setForeignKeyName(oldElementForeignKeyName); } if (keyDependantValue != null) { keyDependantValue.setForeignKeyName(oldKeyForeignKeyName); } }
@SuppressWarnings("rawtypes") public void doSecondPass(Map persistentClasses) throws MappingException { Value element = getCollection().getElement(); DependantValue elementDependantValue = null; String oldElementForeignKeyName = null; if(element instanceof DependantValue) { elementDependantValue = (DependantValue)element; oldElementForeignKeyName = elementDependantValue.getForeignKeyName(); elementDependantValue.setForeignKeyName("none"); // Workaround to avoid DependantValue to create foreignkey just because reference columns are not the same + no need to create keys already in the db! } Value key = getCollection().getKey(); DependantValue keyDependantValue = null; String oldKeyForeignKeyName = null; if (key instanceof DependantValue) { keyDependantValue = (DependantValue)key; oldKeyForeignKeyName = keyDependantValue.getForeignKeyName(); keyDependantValue.setForeignKeyName("none"); } super.doSecondPass(persistentClasses); if(elementDependantValue!=null) { elementDependantValue.setForeignKeyName(oldElementForeignKeyName); } if (keyDependantValue != null) { keyDependantValue.setForeignKeyName(oldKeyForeignKeyName); } }