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: ManyToMany by column that is not PK
PostPosted: Wed Jul 27, 2011 10:38 am 
Newbie

Joined: Tue Jun 21, 2011 5:33 am
Posts: 7
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


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.