Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Error: "Could not synchronize database state with session"

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when does it occur ? can you show some code ?

pascal
 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.





 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic