PersistentObjectException: detached entity passed to persist:
posted 6 years ago
using spring 3.03 and hibernate 3.3.2.GA with postgresql 8.4.x along with Hibernate Commons Annotations 3.1.0.GA.
I have a functional test which tests the persistence layer which is giving me
org.hibernate.PersistentObjectException: detached entity passed to persist: com.vattikutiirf.nucleus.domain.generated.CboImpl.
I have @Transactional for this class, PersistenceLayerImpl and all the DAOImpl classes; I have set show_sql to true and loglevel to trace.
I see that my various DAO classes are getting different Session Objects even though I have passed the same SessionFactory to all of them.
How do I fix this ?
How do I force the same Transaction/Session to be used so that CboImpl does NOT get detached by the time I set it to Family for persistence ?