-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MappingException: Repeated column
PostPosted: Tue Dec 11, 2007 9:02 am 
Newbie

Joined: Mon Dec 05, 2005 7:09 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.