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
|