Hello guys
i understand and i did without problem a relation many-to-many between 2 classes but when each has one varibale how pk/id
like
http://www.hibernate.org/hib_docs/v3...ional-join-m2m
Code:
<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"
class="Address"/>
</set>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
<set name="people" inverse="true" table="PersonAddress">
<key column="addressId"/>
<many-to-many column="personId"
class="Person"/>
</set>
</class>
my problem is when one class has its pk like composite key and the other no
i saw this link
http://www.hibernate.org/hib_docs/v3...key-manytomanybut it a little confuse for me
this is my hbm.xml pk declarations
Code:
<hibernate-mapping
>
<class
name="com.modelo.entidades.CabeceraAlmacen"
table="CabeceraAlmacen"
discriminator-value="CABALM"
>
<composite-id
name="almacenPK"
[b] class="com.modelo.entidades.AlmacenPK"[/b]
>
<key-property
name="idnumero"
type="java.lang.String"
column="idnumero"
length="6"
/>
<key-property
name="serie"
type="java.lang.String"
column="serie"
length="3"
/>
</composite-id>
and the other class
Code:
<hibernate-mapping
>
<class
name="com.modelo.entidades.ArticuloNoAuto"
table="ArticuloNoAuto"
>
<id
name="idArticuloNoAuto"
column="idArticuloNoAuto"
type="java.lang.String"
length="20"
>
<generator class="assigned">
</generator>
</id>
maybe some friendly member can share some code or show me how
resolve this situation
many-to-many with composite key attribute
thanks in advanced
__________________