• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Monu Tripathi
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 ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
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...
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic