Ho un cliente che ha un'associazione con un'entità customerBudget. Un CustomerEntityListener creerà un'entità customerBudget.Crea entità utilizzando EntityListener
ottengo il seguente errore:
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].
il codice a onAfterInsert (entità Customer)
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);
Come posso creare e persistere entités in un EntityListener?