Hibernate has @Any and @ManyToAny annotations for the cases when target entity is identified by type and non-unique id.
I think in your case, since both parent and child are identified this way, you need to create Relation entity with relations to parent and child annotated with @Any.
axtavt
2010-10-18 20:37:58