I am trying to map a relation manytomany between two tables by one column, but I always get some errors:
I have these two tables
-
Organizer with composite
primary key (FIPO,AUSTID) -
Georeferences with
primary key (GVFIID) and the columns FIPOID, ORT, TER, NAT[/code]
I want to be able to get the entrys of Georeferences by the
FIPOID, and thus tried to add this method to Organizer.java
Code:
@ManyToMany
@JoinTable(name="Georeferences",
joinColumns=@JoinColumn(name="fipoid"),
inverseJoinColumns=@JoinColumn(name="fipoid"))
public Set<Georeference> getGeoreferences() { return this.georeferences; }
but get this error:
Quote:
A Foreign key refering at.basiswien.service.entity.Organizer from at.basiswien.service.entity.Georeference has the wrong number of column. should be 2
I also tried:
Code:
@ManyToMany
@JoinTable(name="Georeferences")
@JoinColumn(name="fipoid")
public Set<Georeference> getGeoreferences() { return this.georeferences; }
which leads me to
Quote:
Foreign key (FK11233879DA7811EF:Georeferences [georeferences_GVFIID])) must have same number of columns as the referenced primary key (Georeferences [Veranstalter_AUSTID,Veranstalter_FIPOID,georeferences_GVFIID])
Anyone knows how this mapping can be defined?
Thanks in advance,
Daniel