-->
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: MappingException:Foreign key must have same number of column
PostPosted: Wed Oct 13, 2010 7:23 am 
Beginner
Beginner

Joined: Sat Dec 01, 2007 4:34 pm
Posts: 20
One of my mappings causes this errror: org.hibernate.MappingException: Foreign key (FK9B753AD0E180CB50:TESTANSWER [TESTSENTENCEID])) must have same number of columns as the referenced primary key (TESTSENTENCE [TESTID,SENTENCEID])

Can anyone see what's wrong?

Code:
@Entity
@Table(name = "TESTSENTENCE")
public class TestSentence implements Serializable{

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "TESTSENTENCEID")
  private Long testSentenceId;

  @ManyToOne
  @JoinColumn(name = "TESTID")
  private Test test;

  @ManyToOne
  @JoinColumn(name = "SENTENCEID")
  private Sentence sentence;

Code:
@Entity
@Table(name = "TESTANSWER")
public class TestAnswer implements Serializable{

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(name = "TESTANSWERID")
  private Long testAnswerId;

  @ManyToOne
  @JoinColumn(name = "TESTSENTENCEID")
  private TestSentence testSentence;


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.