openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Saint Croix" <saintx.opensou...@gmail.com>
Subject OneToMany(mappedBy...) special case
Date Thu, 13 Dec 2007 22:54:50 GMT
Hello again,

I have been having a little difficulty determining how to map a special case
of a OneToMany relationship between two of my entity beans.

The first bean, PartyRole, defines a OneToMany relationship to the second
bean, PartyRelationship by way of a Set<PartyRelationship>.  The second
bean, PartyRelationship, has TWO mappings back to PartyRole.
PrimaryPartyRole and SecondaryPartyRole.  PrimaryPartyRole and
SecondaryPartyRole.  Each of these mappings should be ManyToOne.  The
relationship is bidirectional in each case.

However, I'm not sure whether there is a way to define the "mappedBy"
annotation attribute in PartyRole to correctly identify each field as owning
side of their respective relationship.  Can I say
@OneToMany(mappedBy="primaryPartyRole, secondaryPartyRole")?  Something
tells me no.

If this is not possible, is there another way to accomplish this?  Perhaps
an object that represents a link table between these two entities?

Kind regards,
--
Alexander R. Saint Croix

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message