I want to remove an object using entityManager.remove(obj) but i get the following error:
Removing a detached instance org.domain.licenta.entity.Participants#168
Do you know why? How can I remove an object using entityManager?
entityManager is declared as followed:
@In EntityManager entityManager;
You cannot delete a detached entity, only a managed one. If you don't want to load it, you can issue a query to delete it. See the JPA docs on remove()