-->
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: @ManyToOne as part of key
PostPosted: Mon Aug 30, 2010 11:48 am 
Newbie

Joined: Mon Aug 30, 2010 10:50 am
Posts: 1
Hi all,

I'm trying to have a bidirectional relation with the ManyToOne being part of a composite primary key, but the corresponding OneToMany relation can't find the property as soon as I add @Id. E.g.

Code:
@Entity
public class Race {
  @Id @GeneratedValue
  private long id;

  @OneToMany(mappedBy="race")
  private List<Run> runs;
  ...
}

@Entity
public class Run implements Serializable {
  @Id @ManyToOne
  private TimedRace race;
 
  @Id
  private int number;
  ...
}


The error is "mappedBy reference an unknown target entity property: Run.race in TimedRace.runs".

Apologies if this is a silly mistake, but I've not been able to find a solution.

Thanks
Pete


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.