• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for sharing the link.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic