When having two entities with multiple to-many associations between them (say entities {{User}} and {{Address}} and two associations {{User#primaryAddresses()}} and {{User#secondaryAddresses()}}), the same join table name ("User_Address") will be used, causing a constraint violation exception upon insertion for one of the association types, as the column(s) of the other type will be null in that case.
So it'd be nice if automatically either two join tables with unique names were used or at least an error was issued during bootstrap, requesting the user to explicitly specific specify unique names via {{@JoinTable}}.
It might technically also be possible to actually use one join table only, if the columns where nullable. I don't think that's a desirable mapping, though. |
|