-->
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: Column name not found in JoinColumns.referencedColumnName
PostPosted: Fri Nov 20, 2009 10:09 am 
Newbie

Joined: Tue Jan 10, 2006 10:09 am
Posts: 3
Hi,

After reading the documentation and asking Google to no avail, I come here to beg help from the experts.

I have two entities having a one-way master/detail relationship :
- Timeschedule, with a composite primary key {projectBudget + version}
- TimescheduleData, with a composite primary key {projectBudget + version + date}
A Timeschedule record may be related to many TimescheduleData records, by having the same "projectBudget" and "version".

Here is the mapping for the "master" Timeschedule class (irrelevant fields omitted for brevity) :
Code:
@Entity
@Table(name = "timeschedule")
public class Timeschedule implements Serializable {
   @Id
   private TimescheduleId id;

   @OneToMany
   @JoinColumns({
      @JoinColumn(name="projectBudget", referencedColumnName="projectBudget"),
      @JoinColumn(name="version", referencedColumnName="version")
   })
   private List<TimescheduleData> data;
}

@Embeddable
public class TimescheduleId implements Serializable {
   @Column(name = "projectBudget")
   private String projectBudget;
   @Column(name = "version")
   private int version;
}


And here is the mapping for the "detail" TimescheduleData class :
Code:
@Entity
@Table(name="timescheduledata")
public class TimescheduleData implements Serializable {
   @Id
   private TimescheduleDataId id;
}

@Embeddable
public class TimescheduleDataId implements Serializable {
   @Column(name="projectBudget")
   private String projectBudget;
   @Column(name="version")
   private int version;
   @Temporal(TemporalType.DATE)
   private Date date;
}


Hibernate complains with the following error :
Code:
Column name projectBudget of Timeschedule2 not found in JoinColumns.referencedColumnName
   at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:319)
   (...)


Obviously, the problem lies with the list mapping, but I can't figure out why with respect to the documentation.
I would be very grateful if you could help me correct my mapping, please !

I'm using Hibernate 3.3.1.GA and Oracle 10g.

Thank you!


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.