How to update parent without erasing child collections?
Greetings,
I'm using WebWork as a front-end to Spring/Hibernate along with the OpenSessionInViewFilter.
The problem I'm having is that when saving the parent object on an HTML form, the child collections are deleted. When the view is rendered the form values are read from a persistent object in the ThreadLocal Session. When the form is submitted the updated values are bound to a new instance and merged with the existing one.
This works fine, but any collections get wiped out because they are null in the newly instantiated parent object.
Is there some way to indicate that a collection is simply unitialized rather than "empty"?
Is there a way to do a merge() that ignores collections?
Is there a way to initialize/reattach collections to a dirty parent object?
I realize this is easy to fix by storing the updated request values in a transient object and copying them over one-by-one to the persistent object, but it seems like there should be a more elegant way for OSIV. Am I missing something obvious?
Thanks!
Ben