Hello,
I have two entities, a Job and JobExecution. A job can be executed multiple times.
Job (jobId, name) - a physical table with columns (job_id, name) JobExecution ( Job, scheduledDate, status ) - a physical table with columns ( job_id, scheduled_date, status)
The primary key of the JobExecution table is (jobId, scheduledDate) class JobExecution { @EmbeddedId JobExecutionPk pk;
@Column(name = "status") String status; }
class JobExecutionPk { Job job; Date scheduledDate;
public boolean equals() { ...} public int hashCode() { ... } }
class Job { @Id UUID jobId;
@Column(name="name") String name; }
What annotations do I need to use to map the embedded Id to the Job table? I assume I need a @ManyToOne but Where should these annotations go? Should I annotate the field "pk" of JobExecution class or in the "job" field of the JobExecutionPk ?
Any pointers to a similar example would be helpful. I can't seem to find a similar mapping example.
Thank you
-Jorge
|