-->
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.  [ 2 posts ] 
Author Message
 Post subject: Exeption: Repeated column in mapping for collection
PostPosted: Thu Jul 01, 2010 8:01 am 
Newbie

Joined: Thu Jul 01, 2010 7:45 am
Posts: 3
I have 3 tables one for OwnersSheet enity, one for Parcel entity, and one join table. And when I try this code from OwnerSheet entity:

@OneToMany(fetch=FetchType.EAGER)
@JoinTable(name="esPLParcela",
joinColumns={@JoinColumn(name="srez", referencedColumnName="srez", insertable=false, updatable=false),@JoinColumn(name="ko", referencedColumnName="ko", insertable=false, updatable=false),
@JoinColumn(name="pl", referencedColumnName="pl", insertable=false, updatable=false)},

inverseJoinColumns={@JoinColumn(name="srez", referencedColumnName="srez", insertable=false, updatable=false),@JoinColumn(name="ko", referencedColumnName="ko", insertable=false, updatable=false),
@JoinColumn(name="broj", referencedColumnName="broj", insertable=false, updatable=false),@JoinColumn(name="podbroj", referencedColumnName="podbroj", insertable=false, updatable=false)}
)
public Set<Parcel> getParcels() {
return parcels;
}

I got error:

Caused by: org.hibernate.MappingException: Repeated column in mapping for collection: com.gisdata.katastarcg.model.OwnersSheet.parcels column: ko
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:306)
at org.hibernate.mapping.Collection.checkColumnDuplication(Collection.java:329)
at org.hibernate.mapping.Collection.validate(Collection.java:286)
at org.hibernate.mapping.Set.validate(Set.java:19)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1125)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1306)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 70 more

I can't change the column number in those tables, they are already created and filled with data.
Is there any solution to this?

Thanx, Sasha

P.S. OwnersSheet id is composed of columns srez, ko, pl and Parcel id is composed of serz, ko, broj, podbroj


Top
 Profile  
 
 Post subject: Re: Exeption: Repeated column in mapping for collection
PostPosted: Fri Sep 24, 2010 7:40 am 
Newbie

Joined: Thu Jul 01, 2010 7:45 am
Posts: 3
Interesting thing. When I do inverse operation and write @ManyToOne and JoinTable part on the Parcel object i works without any error.

Any suggestion what could this be?

It seems to me that it is some hibernate bug. The same thing doesn't work bidirectional only one way.


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

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.