Is there an example showing a unidirectional many-to-many association mapping with a join table, where the join table contains not just the ids of the two sides of the association, but also an "extra" attribute field containing data pertaining to the association of these two enties?
I see an example with a "clean" link table containing only the two ids, but not one with an extra attribute.
That is, instead of your example in 7.3.4 of the Hibernate 3.2 manual:
Code:
create table Person ( personId bigint not null primary key )
create table PersonAddress (
personId bigint not null,
addressId bigint not null,
primary key (personId, addressId) )
create table Address ( addressId bigint not null primary key )
I have something like this:
Quote:
create table Person ( personId bigint not null primary key )
create table PersonAddress (
personId bigint not null,
addressId bigint not null,
preferenceWeight int not null,
primary key (personId, addressId) )
create table Address ( addressId bigint not null primary key )
I'd like to do the equivalent mapping in section 3.4 but capturing the preferenceWeight attribute in each collection element. How to do this?