Hi,
I have a problem putting together the right annotation syntax for creating a manytomany relation between two tables with composite primary keys, using annotations. I want hbm2ddl to generate the required assocaition table.
Hibernate version:
3.2.2 core / 3.2.1 annotations
Table1:
NationID (PK/FK)
CityID (PK/FK)
PersonID (PK)
Table2:
NationID (PK/FK)
CityID (PK/FK)
EventID (PK) Event
So I want a association table that looks like this:
NationID(FK/PK)
CityID(FK/PK)
PersonID(FK/PK)
EventID(FK/PK)
Is this kind of relation possible using annotations? When I try I get tables like this:
Table1_NationID
Table2_NationID
Table1_CityID
Table2_CityID
PersonID
EventID
What would be the way to tell hibernate that the Nation and city ID should be the same field in the two cases, using annotations? Is it possible? Or do I need to impose some constraints?
thanks in advance!
|