-->
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: Repeated column in mapping for collection
PostPosted: Fri Nov 13, 2009 10:34 am 
Newbie

Joined: Wed Oct 14, 2009 3:22 pm
Posts: 16
Hi,

I'm using Hibernate 3.4.0.GA. I have two objects mapped to database tables (defined in hibernate.cfg.xml like so):

Code:
                <mapping class="myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor" />
                <mapping class="myco.dor.dmv.driver.youthful.model.YouthfulDriverVendorEmail" />


In the database tables, the VENDOR_EMAILS table has a column, VENDOR_ID, which is a foreign key to the primary key (also named VENDOR_ID) of the VENDORS table. In my "YouthfulDriverVendor" model class, I defined the one to many (vendor to one or multiple emails) like so ...

Code:
  @OneToMany
  @JoinTable(name = "VENDOR_EMAILS",
    joinColumns = {
      @JoinColumn(name="VENDOR_ID", unique = true)           
    },
    inverseJoinColumns = {
      @JoinColumn(name="VENDOR_ID")
    }
  )
  private List<YouthfulDriverVendorEmail> emails;


However, I'm getting this error ...

Repeated column in mapping for collection: myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor.emails column: VENDOR_ID
org.hibernate.MappingException: Repeated column in mapping for collection: myco.dor.dmv.driver.youthful.model.YouthfulDriverVendor.emails column: VENDOR_ID
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:329)
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:352)
at org.hibernate.mapping.Collection.validate(Collection.java:309)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1139)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
.....

What adjustments do I need to make to fix the error I'm getting? Thanks, - Dave


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.