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

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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic