Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
7.3. Unidirectional Associations with Join Tables
7.3.1. Unidirectional One-to-many with Join Tables Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
A unidirectional one-to-many association on a join table is the preferred option. Specifying
unique="true", changes the multiplicity from many-to-many to one-to-many.
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<set name="addresses" table="PersonAddress">
<key column="personId"/>
<many-to-many column="addressId"
unique="true"
class="Address"/>
</set>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
</class>
create table Person ( personId bigint not null primary key )
create table PersonAddress ( personId not null, addressId bigint not null primary key )
create table Address ( addressId bigint not null primary key )