Hi,
I have a Customer object with primary key customer_id. I would like to store a record for each customer called CustomerCarrierData in a separate table. There will be only 1 CustomerCarrierData record per customer. But, instead of storing the pk of CustomerCarrierData in the Customer table, I would like to store the customer_id from Customer in the CustomerCarrierData.
When I load up a customer, I would also like to load the corresponding CustomerCarrierData object in the Customer object.
So basically, the code would look something like
Customer c = customerDAO.getCustomer(customer_id);
CustomerCarrierData cd = c.getCustomerCarrierData();
Can someone tell me what kind of association I would have to use on the Customer hibernate mapping file? This is not a many-to-one mapping as the key of the Customer object is being saved in the CustomerCarrierData table (am I wrong?).
An example would be much appreciated.
Thanks,
-Riz.
|