posted 15 years ago
Hi,
Looking at the example in Oreilly ejb3.0 book, a customer can have a collection of phones.
So lets take the implementation where the phone table includes a foreign key to the customer cable (no join table here).
My question is, when I want to save a customer (which has collection of phone objects in it), is just doing
manager.persist(customer) sufficient or I need to have a transaction and do this:
manager.persist(customer);//phones collection here is blank
customer.getPhones.add(phone);
I ask because I tried only doing this: manager.persist(customer) but I get an error saying ORA-01400: cannot insert NULL into PHONE.CUSTOMER_ID.
Tks,
Raj