I'm looking for some clarification on the CascadeType.ALL option when defining relationships between entities.
Example: the Company entity has a property that is of Contact entity type. I am now creating a new Company instance and add a new Contact instance to it with | Company company = new Company() | company.setName("ACME PTY LTD"); | company.setAddress("123 Test St"); | Contact contact = new Contact(); | contact.setName("Daniel"); | contact.setTitle("Mr"); | ...... | company.setContact(contact); i now want to persist my new company instance... Given the fact that I have used CascadeType.ALL when defining the relationship between the contact and the company entity, I am assuming that all I need to do to persist is. | em.persist(company); | however.. this does not work and I am having to persist each object seperately as below.. | em.persist(contact); | em.persist(company); | Is my understanding of the CascadeType.ALL option wrong? Or is my code just not behaving as it should? Regards Daniel View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914700#3914700 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914700 ------------------------------------------------------- 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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user