Currently I am using an <idbag> to map a many-to-many association based on a pure association table with a surrogate primary key. It works fine, but I have to use Collection in my code, whereas I'd like to be able to use Set to keep things consistent. There is a database level uniqueness constraint on the two foreign keys in the association table which should make it possible to use Set semantics, but I cannot figure out a way to convey this to Hibernate. I've tried surrounding the <key...> and <many-to-many...> with <properties> so I could use unique="true", but that didn't work.
Is there a way to do this?
|