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

Error: "Could not synchronize database state with session"

 
Madhu Kumar Vatts
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anybody knows why does this error occur: Appreciate your time in replying.

[java] 2004-10-04 15:56:07,775 ERROR [SessionImpl] <main> net.sf.hibernate.impl.SessionImpl.execute: Could not synchronize database state with session
[java] net.sf.hibernate.HibernateException: SQL insert, update or delete failed (row not found)
[java] at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:25)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:689)
[java] at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642)
[java] at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when does it occur ? can you show some code ?

pascal
 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have same error, let me show you the coding.

Actually, the coding is generated with Hibernate Synchronzier. so the generated coding is Not posted here.

I have the error message below. So I create a Session object, and use dao.save(team,session), in this way no any runtime error. But the problem is , the data is NOT saved into database.





 
Venkat dasari
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to know whether your mapping file is a generated one or have you created you own?
Next, did you test your connection with the mapping file.... I mean when you enter the information in the mapping file wizard did that showed you the tables that are present in the schema(just for checking whether it is getting connected to thedatabase or not)
find out this...then your problem is solved.. it is unable to contact your databse....

regards,
Venkat Dasari
 
Madhu Kumar Vatts
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I figured out the problem for this. The cause of this problem are two

1. When you dont provide the proper primary key/Composite key for the table you match
2. When the primary key in the database is not defined for the table you are mapping to

Other reasons include...Referential integrity..

I have solved my side..Its working ok...Let you know in case if any occurs in future.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic