Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception on delete: save the transient instance before merging

 
everson santos
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I got an exception when I try delete an object: object is an unsaved transient instance - save the transient instance before merging: br.com.Cidade
The code is below:



the entities





I tried save, like said the error message, but didn't work





 
everson santos
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

the problem was my mistake... the was a reference for cidade class in pessoa class,








I set nullable true in mapping and I set cidadenatural as null when I delete... it works




 
everson santos
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!
I'd like know if what I did is the best way to fix that !?

I have person class, and when I tried delete a person showed this message:

object references an unsaved transient instance - save the transient instance before merging






Now I fix that with:
nullable=true and person.setCity(null);








 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does JPA trasient instance mean please?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic