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

This is a typical bidirectional consistency problem. It is well discussed in this link as well as this link. As per the articles in the previous 2 links you need to fix your setters in both sides of the bidirectional relationship. An example setter for the One side is in this link. An example setter … Read more