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!