/** * PUBLIC: * Define the target foreign key relationship in the one-to-many mapping. * This method is used for composite target foreign key relationships. * That is, the target object's table has multiple foreign key fields * that are references to * the source object's (typically primary) key fields. * Both the target foreign key field name and the corresponding * source primary key field name must be specified. * Because the target object's table must store a foreign key to the source table, * the target object must map that foreign key, this is normally done through a * one-to-one mapping back-reference. Other options include: * <ul> * <li> use a DirectToFieldMapping and maintain the * foreign key fields directly in the target * <li> use a ManyToManyMapping * <li> use an AggregateCollectionMapping * </ul> * @see DirectToFieldMapping * @see ManyToManyMapping * @see AggregateCollectionMapping */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourceKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourceKeyFieldName)); }
/** * PUBLIC: * Define the target foreign key relationship in the one-to-many mapping. * This method is used for composite target foreign key relationships. * That is, the target object's table has multiple foreign key fields * that are references to * the source object's (typically primary) key fields. * Both the target foreign key field name and the corresponding * source primary key field name must be specified. * Because the target object's table must store a foreign key to the source table, * the target object must map that foreign key, this is normally done through a * one-to-one mapping back-reference. Other options include: * <ul> * <li> use a DirectToFieldMapping and maintain the * foreign key fields directly in the target * <li> use a ManyToManyMapping * <li> use an AggregateCollectionMapping * </ul> * @see DirectToFieldMapping * @see ManyToManyMapping * @see AggregateCollectionMapping */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourceKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourceKeyFieldName)); }
/** * PUBLIC: * Define the target foreign key relationship in the one-to-many mapping. * This method is used for composite target foreign key relationships. * That is, the target object's table has multiple foreign key fields * that are references to * the source object's (typically primary) key fields. * Both the target foreign key field name and the corresponding * source primary key field name must be specified. * Because the target object's table must store a foreign key to the source table, * the target object must map that foreign key, this is normally done through a * one-to-one mapping back-reference. Other options include: * <ul> * <li> use a DirectToFieldMapping and maintain the * foreign key fields directly in the target * <li> use a ManyToManyMapping * <li> use an AggregateCollectionMapping * </ul> * @see DirectToFieldMapping * @see ManyToManyMapping * @see AggregateCollectionMapping */ public void addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourceKeyFieldName) { addTargetForeignKeyField(new DatabaseField(targetForeignKeyFieldName), new DatabaseField(sourceKeyFieldName)); }
mapping.addTargetForeignKeyField(fkField, pkField);