2012-01-04 209 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>