|FK value setting in a ManyToOne relationship [message #646656]
||Wed, 29 December 2010 16:51
| No real name
Registered: December 2010
Hi, I have a OneToMany relationship between entities Contact and Email. When I create a Contact and add to him 1 or more Email I need to set the FK column in Email table to the right Contact of that email...|
I tried this:
private Set<ContactEmail> email;
private Contact contact;
When in my test package I call:
em.persist(contact); //(where contact has 2 emails associated)
it creates 1 contact, 2 emails records but the FK column "CONTACT_ID" is empty...
how can I set its value with the right Contact ID of that email?
thanks in advance!
[Updated on: Wed, 29 December 2010 16:53]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03828 seconds