You dont have to retrieve the object from the database.

Pretty simple:

create a Country object and insert the pk:
Country country = new Country();
country.setId(2);

Then create the person object and insert the contry object:
Person person = Person();
person.setCountry(country);

....
Then
em.persist(person);


About the load method, with the EntityManager you have to use find
find retrieves the class of the object and the PK;

Regards



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918339#3918339

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918339


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to