2012-01-04 57 views
0

我使用Tomcat服務器,我昨天早上開始它,它持續運行,直至今天早上,但是當我試圖在我的應用登錄它表明:org.hibernate.TransactionException:JDBC回滾失敗例外

org.hibernate.TransactionException: JDBC rollback failed 

問題是什麼 - 這裏的任何持久會話還是sessionfactory爲空?

+0

請發佈**完整** stacktrace。 – 2012-01-04 06:15:04

回答

0

我得到了這個問題, 即我連着一個名爲c3p0-0.9.1.jar文件不同的罐子,並添加在休眠-cfg.xml文件中的某些行

的代碼是:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
<hibernate-configuration> 
<session-factory>       
    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property> 
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> 
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/<your db name></property> 
    <property name="hibernate.connection.username">root</property> 
    <property name="hibernate.connection.password">test</property> 
    <property name="hibernate.connection.autocommit">false</property> 
    <property name="hibernate.hbm2ddl.auto">update</property> 
    <property name="hibernate.show_sql">true</property> 
    <property name="hibernate.format_sql">true</property> 
    <property name="hibernate.jdbc.batch_size">50</property> 

      //Here is the extra code for handling the above problem..... 

    **<property name="hibernate.c3p0.max_size">1</property> 
    <property name="hibernate.c3p0.min_size">0</property> 
    <property name="hibernate.c3p0.timeout">5000</property> 
    <property name="hibernate.c3p0.max_statements">1000</property> 
    <property name="hibernate.c3p0.idle_test_period">300</property> 
    <property name="hibernate.c3p0.acquire_increment">1</property>** 
</session-factory> 
</hibernate-configuration>