David Ward wrote: > 1) Note to Peter - you can't have a message bean involved in a cmr > relationship (only entities can participate in cmr's), so I'm a bit > confused by your first statement.
I think he has an entity named Message. > 2) I started this thread, and though I think I found the right way to do > it a while ago, I've negleted to share what I've learned with the > community. (bad me.) So here goes (granted, I haven't tested this > completely yet, but it's looking good so far)... > > If you want a bidierectional parent-child relationship where both the > parent and the child are of the same bean, *you have to define two > relationships, not one*: > > - The first specifies the one-2-one unidirectional relationship an > entity has with its parent. This will correlate with an abstract > get/setParent(YourBeanLocal) in the bean. > > - The second specifies the one-2-many unidirectional relationship an > entity has with its children. This will correlate with an abstract > get/setChildren(Collection) in the bean. > > It seems impossible to do this bidirectionaly in a single relationship > definition. > > Dain, do you agree with my methodology? Uh, no. This sounds like a hack. You should be able to have a one-to-many self-relationship. For example in a person bean you should be able to have, literally, a parent-child relationship with the following abstract accessors. public abstract Person getParent(); public abstract void setParent(Parent parent); public abstract Set getChildren(); public abstract void setChildren(Set children); If this doesn't work, it is a bug. I have a test case for this, but it could be broken. As a side note, I think Peter is attempting to use a not null fk or a fk in a pk which does not work currently. -dain _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user