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