1. Error messages
Request processing failed; Nested exception is org.springframework.dao.InvalidDataAccessApiUsageException:Multiple representations of the same Entity
2. Cause of Error
Because an attempt is made to assign an already persistent object or detached object value to a property of a new transient object. The transient object that caused the last save or merge to report the error.
3. Solutions
This should be a bug in Hibernate itself, which has been resolved in version 4.2.15.
1, update hibernate version to 4.2.15 or more
2, add the following properties to hibernate's configuration file:
<property name= "Hibernate.event.merge.entity_copy_observer" >allow</ PROPERTY> |
If you are using Spring management hibernate, configure
in your spring data source
<prop key= "Hibernate.event.merge.entity_copy_observer" >allow
</PROP> |
Specific reference: http://thinerzq.me/2016/02/01/Multiple-representations-of-the-same-entity-are-being-merged%E8%A7%A3% e5%86%b3%e6%96%b9%e6%b3%95/
Request processing failed; Nested exception is org.springframework.dao.InvalidDataAccessApiUsageException:Multiple representations of the same Entity resolution method