3 April 2013

How to solve problem with error javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist

I trying to use yml to create a temp database for test purposes.
Address(A1):
 
id: 1
  nickname: "an address"
  line_1: "Somewhere"
  line_2: " Lollypop factory "
  line_3: "funky factory"
  town: "Sugarfree town"
  county: "Country"
  postcode: "UK1 LOL"


So you copy record from database into yml and you see this weird message:

javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist:

  with lots meaningless stack trace.

Problem in this case is that ... hibernate fails if the id was already assigned,because id is automatically assigned.

Good to know...

Source: http://stackoverflow.com/questions/15198675/javax-persistence-persistenceexception-org-hibernate-persistentobjectexception

No comments:

Post a Comment