Spring-Hibernate: How to submit a for when the object has one-to-many relations?

Posted by Czar on Stack Overflow See other posts from Stack Overflow or by Czar
Published on 2011-01-12T10:36:42Z Indexed on 2011/01/12 10:53 UTC
Read the original article Hit count: 251

Hi,

I have a form changeed the properties of my object CUSTOMER. Each customer has related ORDERS. The ORDER's table has a column customer_id which is used for the mapping. All works so far, I can read customers without any problem.

When I now e.g. change the name of the CUSTOMER in the form (which does NOT show the orders), after saving the name is updated, but all relations in the ORDERS table are set to NULL (the customer_id for the items is set to NULL.

How can I keep the relationship working?

THX

© Stack Overflow or respective owner

Related posts about spring

Related posts about forms