I am working on a new project that has an existing MySQL database of around 45 tables. The design is such that some some table can have multiple fields in the primary key (even entity tables), and foreign keys can contain multiple fields. For instance table
oppprodcountries has fields (ProductID,OppID) that references the oppproducts key (ProductID,OppID). The database looks ok, but I get the following error:
Can't generate seam entities
org.hibernate.MappingException: An association from the table oppprodcountries refers to an unmapped class: org.domain.PCT.entity.OppProducts
oppprodcountries has the following foreign keys:
FOREIGN KEY (ProductID,OppID) REFERENCES oppproducts(ProductID,OppID)
FOREIGN KEY (ProductID,CountryID) REFERENCES prodcountries(ProductID,CountryID)
Normally I would design a single id field and not have multiple fields in the entity tables. However I have tried a small test with the above approach (multiple field keys) and it did work. I am not sure why I get the error above?
So.... any ideas??