I can see why this is occurring, but I’m not sure of how to resolve in the studio.
I have an entity say Basket.class
In Basket.class I have
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = “BASKET_ID”)
protected List fruit;
Note: Is is important to not use any of the soft-deletion functionality.
Now what I want to be able to do is create the fruit while creating the basket.
So I open a standard editor for Basket. The editor contains a table with fruit (which will be empty for a new basket). On the table I have an action and button to “Create Fruit”. Which opens up the fruit editor. So I create a new fruit.
I want to be able to create a new fruit and put it in the basket while creating the basket. And when the basket is saved to then save the fruit. It keeps trying to save the fruit first (which is obvious i guess).
I am having all sorts of problems where the fruit is saving and when I save the basket I get unique violation error as the basket has already been saved. (This is with a nestled datasource). If I used a collection datasource that is not nestled the fruit is created but not saved to the basket, or i get a jpql error about the basket not being saved.
Whats the easiest solution for this?