Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PersistentObjectException: detached entity passed to persist:

 
anjan bachchu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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 ?

Thanks for any clues,

BR,
~A







applicationContext.xml


 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!