Skip to content
Advertisement

Tag: cascade

How to cascade delete set of enums in JPA?

I have the roles field in User entity: when I try to delete user with a query, the referential integrity constraint violation occurs, because user is referenced from User_roles table. How to solve this in any way? DDL for related table shows i.e. it doesn’t contain ON DELETE CASCADE clause. I need it be there. Answer You can add ON

Detached entity passed to persist when save the child data

I’m getting this error when submitting the form: org.hibernate.PersistentObjectException: detached entity passed to persist: com.project.pmet.model.Account; nested exception is javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: com.project.pmet.model.Account Here are my entities: Account: Team: Here’s a part of the Controller: And the form: What am I doing wrong? Answer Save method accepts only transient objects. What is the transient object you can

Advertisement