I am having some trouble working with nested objects using a composition structure. In my case, there are a number of objects that are related as such:
Main object > Composition objects > Composition objects
E.g, consider this scenario:
Meeting session > Discussion topics > Comments
Typically, when creating a new session, adding topics and for these topics adding comments, there is an error when clicking save on a newly created comment (while the discussion/meeting has not been saved before).
I have tried to avoid the error by having all fields (including system properties) in the view definition(s) used to build the screens. However, when saving the ‘topic’ to the ‘meeting’ while containing some comments, this still runs into an error:
IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: com.company.composition.entity.Topic-7dababc6-0128-c91b-1acc-0de41eac0068 [new].
Is there any guideline to follow and make this work consistently?
Attached is the project that shows the problem.