Hibernate version:
hibernate-3.2.1ga
hibernate-annotations-3.2.1ga
hibernate-entitymanager-3.2.1ga
(from repo1.maven.org)
Full stack trace of any exception that occurs:
Caused by: org.hibernate.MappingException: Repeated column in mapping for collection: de.uniulm.iai.domain.lecture.Lecture.tutorials column: semester
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:304)
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:327)
at org.hibernate.mapping.Collection.validate(Collection.java:284)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1103)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1284)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
... 47 more
(I skipped the spring exception which was thrown after this Hibernate Exception).
Name and version of the database you are using:
HSQLDB Version: 1.8.07
I used JPA Annotations to map the many-to-many relation shown below.
Code:
Lecture LectureTutorial Tutorial
------------------- ------------------- ------------------
| lid PK | | lid PK | | tutor PK |
| semseter PK | 1 -->* | semester PK | * <-- 1 | semester PK |
| ... | | tutor PK | | weekday PK |
------------------- | weekday PK | | startTime PK |
| startTime PK | | .... |
------------------- ------------------
And this is the relevant mapping part within my JPA Entitybean, currently only a unidirectional mapping:
Code:
Lecture.java:
...
@ManyToMany
@JoinTable (
name="LectureTutorials",
joinColumns={
@JoinColumn (name="lid"),
@JoinColumn (name="semester")
},
inverseJoinColumns={
@JoinColumn (name="tutor"),
@JoinColumn (name="semester", insertable=false, updatable=false),
@JoinColumn (name="weekday"),
@JoinColumn (name="startTime")
}
)
private Collection<Tutorial> tutorials = new ArrayList<Tutorial>();
...
Yes, I see that I have specified the column "semester" two times, but duplicating the column is not a possible solution, my schema is fixed. I have seen some other post with a similar problem (like
http://forum.hibernate.org/viewtopic.php?t=927698).
Any ideas? Is there still no solution?
Steffen