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?