/** * PUBLIC: * Add a foreign key constraint to the table. * If there is a same name foreign key constraint already, nothing will happen. */ public void addForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable) { ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(name, sourceField, targetField, targetTable); addForeignKeyConstraint(foreignKey); }
/** * PUBLIC: * Add a foreign key constraint to the table. * If there is a same name foreign key constraint already, nothing will happen. */ public void addForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable) { ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(name, sourceField, targetField, targetTable); addForeignKeyConstraint(foreignKey); }
/** * PUBLIC: * Add a foreign key constraint to the table. * If there is a same name foreign key constraint already, nothing will happen. */ public void addForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable) { ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(name, sourceField, targetField, targetTable); addForeignKeyConstraint(foreignKey); }
/** * INTERNAL: * Build the foreign key constraints. */ protected void buildFieldTypes(AbstractSession session) { FieldDefinition field = null; // The ForeignKeyConstraint object is the newer way of doing things. // We support FieldDefinition.getForeignKeyFieldName() due to backwards compatibility // by converting it. To allow mixing both ways, we just add converted one to foreignKeys list. for (Enumeration enumtr = getFields().elements(); enumtr.hasMoreElements();) { field = (FieldDefinition)enumtr.nextElement(); if (field.getForeignKeyFieldName() != null) { addForeignKeyConstraint(buildForeignKeyConstraint(field, session.getPlatform())); } } }
targetTableDef, this.databasePlatform); constraint.setShouldCascadeOnDelete(cascadeOnDelete); sourceTableDef.addForeignKeyConstraint(constraint);
sourceTableDef.addForeignKeyConstraint(fkc);
targetTableDef, this.databasePlatform); constraint.setShouldCascadeOnDelete(cascadeOnDelete); sourceTableDef.addForeignKeyConstraint(constraint);
/** * INTERNAL: * Build the foreign key constraints. */ protected void buildFieldTypes(AbstractSession session) { // The ForeignKeyConstraint object is the newer way of doing things. // We support FieldDefinition.getForeignKeyFieldName() due to backwards compatibility // by converting it. To allow mixing both ways, we just add converted one to foreignKeys list. for (FieldDefinition field : getFields()) { if (field.getForeignKeyFieldName() != null) { addForeignKeyConstraint(buildForeignKeyConstraint(field, session.getPlatform())); } } }
/** * INTERNAL: * Build the foreign key constraints. */ protected void buildFieldTypes(AbstractSession session) { // The ForeignKeyConstraint object is the newer way of doing things. // We support FieldDefinition.getForeignKeyFieldName() due to backwards compatibility // by converting it. To allow mixing both ways, we just add converted one to foreignKeys list. for (FieldDefinition field : getFields()) { if (field.getForeignKeyFieldName() != null) { addForeignKeyConstraint(buildForeignKeyConstraint(field, session.getPlatform())); } } }