I got the following warning:
Sep 15, 2009 5:52:48 PM com.avaje.ebean.server.persist.DefaultPersister saveAssocManyIntersection
WARNING: Save cascade on ManyToMany [purposes]. The collection [class java.util.HashSet]was not a BeanCollection. The additions and removals can not be determined and *NO* inserts or deletes to the intersection table occured.
I understand the problem - the owning instance is new so the set is of course a HashSet and not a BeanCollection.
So what is the solution to this problem?
1) I need to save the owning object first and load it again so as I now have a BeanCollection
2) Cascading could probably assume that it should insert all the objects in the set if the owning object is new?
Perhaps there is a simple elegant solution?