Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hibernate Exception: Could not insert and JDBC Rollback failed..

 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written the following class to persist mapped POJOs to MySQL database.

My hibernate configuration file is set up as:


When i use this class, I get Hibernate Exceptions (occuring sporadically):
1. Could not insert[POJO.Logging]
2. JDBC rollback failed.

In most cases, the same code works like i expect it to. I understand that "could not insert" could be due to several reasons(bad data/ constraint violation); but the data populated in the POJO is generated by the application and is allegedly unique.

Q1.Could there be any other issue (like say...object state conflicts??) which could give rise to "insert" errors?

Q2.Assuming that, there was an exception in the try block, why is rollback failing?

Q3.What happens when the tx.commit(); statement fails; i mean how is the rollback handled?


Please help..
[ November 10, 2008: Message edited by: Monu Tripathi ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monu,

Without seeing the entire exception stacktrace, we wont be able to know what might be wrong Please post the entire exception stacktrace.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just captured the error message in my logs but not the entire stack trace.
Unfortunately, I can't recreate it as and when I'd like(this is all i can tell at the moment).

I'd appreciate any pointers or links that will help understand hibernate commits and rollback(in terms problems and issues that may surmise).

Thanks in advance...
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without the stack trace there is not much you (or we) can do.

But this is a good Wiki entry about Hibernate transactions.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing the link.
 
Water proof donuts! Eat them while reading this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic