PersistentObjectException: detached entity passed to persist thrown by JPA and Hibernate

  • Post author:
  • Post category:Bugs
  • Post comments:0 Comments
  • Post last modified:November 7, 2021
  • Reading time:1 mins read

This is a typical bidirectional consistency problem. The solution is very simple,

Solution:

Just use the CascadeType.MERGE instead of CascadeType.PERSIST or CascadeType.ALL.

I have had the same problem and CascadeType.MERGE has worked for me.

Hope it helps….

Leave a Reply