My database structure mainly consists of multiple primary keys per table, therefore multiple columns are required per join. I'm trying to use ColdFusion (11 to be specific) ORM relation property that has a linktable. I think the issue is with two keys on one side of the many-to-many relationship and just one on the other. Here is what I've tried without success:
Table Setup
Staff StaffSites Sites
============ ============ ===========
YearID (PK) --- YearID (PK)
StaffID (PK) --- StaffID (PK) SiteName
StaffName SiteID (PK) --- SiteID (PK)
Staff ORM CFC
component persistent=true table='Staff' {
property name='id' column='StaffID' fieldType='id';
property name='year' column='YearID' fieldType='id';
property name='name' column='StaffName';
property name='sites'
cfc='site'
linkTable='StaffSites'
fkColumn='YearID,StaffID'
inverseJoinColumn='SiteID'
mappedBy='id'
fieldType='many-to-many'
lazy=true;
}
Site ORM CFC
component persistent=true table='Sites' {
property name='id' column='SiteID' fieldType='id';
property name='name' column='SiteName';
}
ColdFusion Error
collection foreign key mapping has wrong number of columns: staff.sites type: integer