ManyToMany from and to the same object by using a non primary key column
------------------------------------------------------------------------
Key: ANN-835
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-835
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Core 3.3.1.GA, Annotations 3.4.0, Postgres 8.3, JBoss 4.2.3 JDK6,
Seam 2.1.1.GA
Reporter: Frank Pfleger
A ManyToMany relationship to the same table and the same property produces a
MappingException on JBoss startup.
Caused by: org.hibernate.MappingException: Duplicate property mapping of
_org_weazel_security_entity_impl_Group_groups found in
org.weazel.security.entity.impl.Group
at
org.hibernate.mapping.PersistentClass.checkPropertyDuplication(PersistentClass.java:477)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:467)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 145 more
An Example Annotation that works fine between different tables and objects (NUMBER is a
non primary key column/property)
@ManyToMany
@JoinTable(joinColumns=@JoinColumn(name="NUMBER1",
referencedColumnName="NUMBER")),
inverseJoinColumns=@JoinColumn(name="NUMBER2",
referencedColumnName="NUMBER"))
Using this Annotation between different classes works fine as said before.
The Problem is the syntheticPropertyName (_org_weazel_security_entity_impl_Group_groups)
generated in BinderHelper.createSyntheticPropertyReference which is the same for both
parts/ends of the ManyToMany relationship.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira