Hi,
I want to model an "association-class" or to be more precise the "role" of an object in an association :
I've got a "group" class and a "person" class already.
A group has a direct reference to the 'supervisor' person but i want to model the fact that a group has a set of persons, said 'vips' linked via a role (some are 'Main staff', others 'special guest'... etc)
Code:
GROUP<----role---->PERSON
in summary, i would have a join table like this :
GROUP_ID(int), ROLE(String), PERSON_ID(int)
I tried :
Code:
(in group.hbm...)
<set name="vips" table="XREF_VIPS_OF_GROUP" lazy="true">
<key column="GROUP_ID" />
<composite-element
class="com.VipRepresentation">
<property name="role" column="ROLE" />
<many-to-one column="PERSON_ID" name="person"
class="com.Personne" />
</composite-element>
</set>
1) It seems to work but i got some delete + insert when i simply load groups ???
2) Given a person, can i retreive groups it is linked on ? (can this association be bi-directionnal?)
Thanks for your feedback.