• Post Reply Bookmark Topic Watch Topic
  • New Topic

Could not synchronize database state with session

 
Martin Lopez Ochoteco
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I'm having trouble trying to persist an entity which ID is a generated value. This entity (A), at persistence time, has to persist in cascade another entity(B). The relationship within A and B is OneToMany, and the property related in B is part of a composite key.

I'm using Eclipse, JBOSS Runtime, JPA/Hibernate

Here is my code:

Entity A:


Entity B:


Entity B PK:


Client:


ERROR:


Thanks in advance!
 
Martin Lopez Ochoteco
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to set cambios.idCambio manually but I'm still getting the same error. Hibernate should do some kind of mapping between objetosCambioPK.idCambio and objetosCambio.cambios.

Perhaps that's wthat I'm missing here, and I don't know how to implement it.

Anyone?
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!