Saving new Item with Composition Relation / cascade PERSIST Error

Hello together,

i experienced an issue and already found the source. So I was just wondering, if this was “supposed” to happen:

  1. I have an Order Entity with a relation to an OrderLine Entity (Composition).
  2. In the OrderLine Editor, i created a nested Datasource “OrderDs” ==> so basically the Foreign Key attribute of the OrderLine Entity.
  3. if i create a new Order, with new OrderLine Items and try to save the Order, I get an:

java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST

As soon as a save the new Order first, before adding the OderLine Items, it works. Also if i delete the nested Datasource of the OrderLine Editor, it also works without saving the Order first.

Is this supposed to happen?


Hello together,

there i am again. I found another Issue, which i don’t know how to get rid of. I have attached a sample Project (Cuba v6.9.5), which shows the error.

Let me just explain it:

The Sample Data Model Consists of:

“Order” Entity which has a One-to-Many Composition of the “OrderLine” Entity.
“OrderLine” Entity has a One-to-Many Composition of the “OrderLinePosition” Entity.

Following Issue:

  1. I create a Order

  2. I add an Order Line

  3. Next up I’am adding a Order Line Position

  4. The moment i try to add (click OK in the OrderLine Editor) the Order Line, i get the following Error:

I have attached the given Project to this Reply. Please let me know if you need any further information.
I need this functionality in a coming production application (father - Son - grandson, one-to-many composition). A workaround would also do the job for me.

Thanks in advance
Daniel (93.2 KB)

Hi Daniel,

You should define the correct view and the structure of datasources in the root editor of your composition. See an example here.

1 Like

Hi Konstantin,

this was exactly the information i needed. thanks, solved the issue.