From: Christopher G. S. II (JIRA) <no...@at...> - 2006-07-07 15:52:05
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-389?page=comments#action_23572 ] Christopher G. Stach II commented on ANN-389: --------------------------------------------- EJB 3.0 Final: 2.1.7 Entity Relationships The following rules apply to bidirectional relationships: * The inverse side of a bidirectional relationship must refer to its owning side by use of the mappedBy element of the OneToOne, OneToMany, or ManyToMany annotation. The mappedBy element designates the property or field in the entity that is the owner of the relationship. [...] * For many-to-many bidirectional relationships either side may be the owning side. I don't think that the second point allows for BOTH sides to be the owning side because that would clearly violate the first point. 9.1.26 ManyToMany Annotation Every many-to-many association has two sides, the owning side and the non-owning, or inverse, side. This does not say "only some many-to-many associations have two sides." Besides the spec saying that it "must" have mappedBy on one of the sides, it's a retarded use case to have duplicate join tables for the same relation. Who does that and why? > @ManyToMany without mappedBy should be recognized as an error > ------------------------------------------------------------- > > Key: ANN-389 > URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-389 > Project: Hibernate Annotations > Type: Bug > Components: binder > Versions: 3.2.0.cr1 > Reporter: Christopher G. Stach II > > > Instead of letting the user know that something might get hosed, it creates two join tables, one for each direction. I don't know when this would be the preferred behavior. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |