I'm having a lot of trouble mapping a one-to-one relationship. I tried with a foreign key asscociation and with both table's primary key's matching. Can someone please show me how to do this?
I have 2 tables : QueryGroup and GroupEmailInfo.
I want the QueryGroup class to contain GroupEmailInfo as a member.
When a new queryGroup is saved I want the related GroupEmailInfo to be saved as well with the correct id.
Here are the classes:
Code:
public class Query_Group implements Serializable {
/** identifier field */
private Long id;
/** nullable persistent field */
private String interval;
/** nullable persistent field */
private Timestamp last_run_dte;
/** nullable persistent field */
private String group_name;
/** nullable persistent field */
private String group_status_cde;
/** nullable persistent field */
private net.idt.ReportEngine.dao.GroupEmailInfo groupEmailInfo;
...
and
public class GroupEmailInfo implements Serializable {
/** identifier field */
private Long id;
/** nullable persistent field */
private Long group_id; // not necessary - i would only use this for a foreign key asscociation
/** nullable persistent field */
private String subject;
/** nullable persistent field */
private String body;
/** nullable persistent field */
private String from_address;
How would I map this???
Please help!