Thanks for sharing. Matt
On 9/7/07, gederer <[EMAIL PROTECTED]> wrote: > > Hi, > > I figured this out with some help from the persistence-glassfish folks (who > can make JPA do back flips, and are terrific helpers!) > > Here's the solution, in case anyone's interested: > > @ManyToMany > @JoinTable( > name="parent_child_category", > [EMAIL PROTECTED](name="child_id", referencedColumnName="id"), > [EMAIL PROTECTED](name="parent_id", > referencedColumnName="id") > ) > private List<ToyCategory> parentCategories = new > ArrayList<ToyCategory>(); > > @ManyToMany(mappedBy = "parentCategories") > private List<ToyCategory> childCategories = new > ArrayList<ToyCategory>(); > > Now my categories can have multiple parents. Sweet! > > Cheers, > > Greg > > > > gederer wrote: > > > > Hi, > > > > This is really a JPA question. But, I think someone around here might have > > a quick, simple answer. > > > > I have a Category class. According to my model, a Category can have many > > parent Categorys and many child Categorys. I'm having trouble getting the > > (JPA) annotations right for this relationship. I'm sure that this must be > > trivially easy. > > > > Does anyone know the correct way to do this? > > > > Thanks! > > > > Greg > > > > -- > View this message in context: > http://www.nabble.com/many-to-many-self-reference-with-JPA-tf4393538s2369.html#a12537146 > > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
