openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <>
Subject Re: ManyToMany - with a twist
Date Wed, 22 Aug 2007 06:31:36 GMT

It sounds like you're looking for OpenJPA's constant join behavior.
You can read about it at


On 8/21/07, Nat Gross <> wrote:
> [In an existing ejb 2 application] I have an interesting manytomany
> scenario.
> Class EntityA with a 1 field Integer pk can relate to other instances of
> itself in more than one way.
> Not only can it have many  EntityA children and have many EntityA parents it
> can have the SAME EntityA Parent/Child more than once.
> Each EntityA needs a reason as to why it relates to the other EntityA.
> (Suppose EntityA is a Person that can relate to another Person in more than
> one way, say a cousin,  a spouse, employer, business partner. [ahem<g>])
> Currently I have a table, ARELATIONS, with three Integer fields: srcPK,
> targetPK, relateType. All three fields make up the PK. Currently I am
> manually controlling the joins of this table with EntityA. I would like to
> utilize jpa to do this.
> Also important to note is that it is not enough for the end-user to simply
> fetch related EntityA records, the *reason* (relateType) is also important.
> Basically I should be able to define two OneToMany Unidirectional
> Collection<Arelations> fields in EntityA, but whatever I try with Toplink I
> get different problems. (Basically, Toplink wants yet another intersection
> table, which I don't want.)
> I hope openjpa has a better solution.
> Please adivse.
> Thanks
> natG

Patrick Linskey
202 669 5907

View raw message