There's some cases where using Hibernate EM I got this exception trying to persist an entity: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist I think my code is right, however I got this exception. I have eventually concluded this might be a bug in Hibernate EM. I would appreciate any comments on this post.
In order to avoid keeping this scenario in two places, please read the whole scenario here.