Skip to content
Advertisement

java.lang.IllegalStateException: Multiple representations of the same entity with @ManyToMany 3 entities

I have 3 entities with ManyToMany relationships:

Role Entity:

JavaScript

Permission Entity:

JavaScript

Functionality Entity:

JavaScript

I did the following:

  1. I have created 3 functionalities:

    JavaScript
  2. Then created 2 permissions:

    JavaScript
  3. Then created a role:

    JavaScript

I am getting the following exception:

java.lang.IllegalStateException: Multiple representations of the same entity [com.persistence.entity.admin.Functionality#1] are being merged. Detached: [com.persistence.entity.admin.Functionality@4729256a]; Detached: [com.persistence.entity.admin.Functionality@56ed25db]

Advertisement

Answer

Fixed it by removing CascadeType.MERGE on Permission entity

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement