Mam klienta, który ma powiązanie z jednostką CustomerBudget. CustomerEntityListener utworzy encję CustomerBudget.Utwórz encję za pomocą EntityListener
pojawia się następujący błąd:
IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: de.company.entity.Customer-c4775b5b-413b-0567-3612-e0860bca9300 [new,managed].
kod w onAfterInsert (podmiot klienta)
LoadContext<Customer> loadContext = LoadContext.create(Customer.class);
loadContext.setId(entity.getId());
Customer customer = dataManager.load(loadContext);
CustomerBudget customerBudget = new CustomerBudget();
customerBudget.setCustomer(customer);
CommitContext commitContext = new CommitContext(customerBudget);
dataManager.commit(commitContext);
Jak mogę tworzyć i utrzymywać udziałów w jednostkach w EntityListener?