hi,
I'm trying to get the primary key after execute the following code, but keep getting a null primary key even though the database is updated correctly.
Country has one-to-many relationship with user
[code]
Country country = (Country)em.find(Country.class, countryid);
user.setCountry(country);
country.getUserinfoCollection().add(user);
em.merge(country);
[/code]
also, if i do
[code]
user.setCountry(new Country(id));
em.persist(user);
[/code]
sometime I got the key, but sometime i got null
I'm using Table generator to generate the key
Thanks for your help
jeff
[Message sent by forum member 'eviljanca' (eviljanca)]
http://forums.java.net/jive/thread.jspa?messageID=233540