Problem: Trying to update a child collection the entire collection was wiped out
Solution: Call the EntityManager’s refresh() method before calling flush()
Environment Notes: Google App Engine, Datanucleus JPA, Spring MVC 3
Summary: I as working with a detached copy of the Parent entity. When I called EntityManager’s merge(Obj o) function it essentially wiped out the list because it copied in an empty list. Calling flush() essentially set the empty list in the database. Calling refresh(Obj o) before calling flush() refreshed the object with its corresponding database entries.
References:
Forum Post
EntityManager API Documentation
http://download.oracle.com/