/** * PUBLIC: * Define the target foreign key relationship in the 1-1 mapping. * This method is used for composite target foreign key relationships, * that is the target object's table has multiple foreign key fields to * the source object's primary key fields. * Both the target foreign key field name and the source primary key field * name must be specified. * The distinction between a foreign key and target foreign key is that the * 1-1 mapping will not populate the target foreign key value when written * (because it is in the target table). Normally 1-1's are through foreign * keys but in bi-directional 1-1's the back reference will be a target * foreign key. In obscure composite legacy data models a 1-1 may consist of * a foreign key part and a target foreign key part, in this case both * method will be called with the correct parts. */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourcePrimaryKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourcePrimaryKeyFieldName)); }
/** * PUBLIC: * Define the target foreign key relationship in the 1-1 mapping. * This method is used for composite target foreign key relationships, * that is the target object's table has multiple foreign key fields to * the source object's primary key fields. * Both the target foreign key field name and the source primary key field * name must be specified. * The distinction between a foreign key and target foreign key is that the * 1-1 mapping will not populate the target foreign key value when written * (because it is in the target table). Normally 1-1's are through foreign * keys but in bi-directional 1-1's the back reference will be a target * foreign key. In obscure composite legacy data models a 1-1 may consist of * a foreign key part and a target foreign key part, in this case both * method will be called with the correct parts. */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourcePrimaryKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourcePrimaryKeyFieldName)); }
/** * PUBLIC: * Define the target foreign key relationship in the 1-1 mapping. * This method is used for composite target foreign key relationships, * that is the target object's table has multiple foreign key fields to * the source object's primary key fields. * Both the target foreign key field name and the source primary key field * name must be specified. * The distinction between a foreign key and target foreign key is that the * 1-1 mapping will not populate the target foreign key value when written * (because it is in the target table). Normally 1-1's are through foreign * keys but in bi-directional 1-1's the back reference will be a target * foreign key. In obscure composite legacy data models a 1-1 may consist of * a foreign key part and a target foreign key part, in this case both * method will be called with the correct parts. */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourcePrimaryKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourcePrimaryKeyFieldName)); }
DatabaseField targetField = inverse.getSourceToTargetKeyFields().get(sourceField); dm.addTargetForeignKeyField(sourceField, targetField);