繁体   English   中英

Hibernate 4默认事务超时值

[英]Hibernate 4 default transaction timeout value

我收到此错误:

2014-11-14 17:39:44 [WARN]SqlExceptionHelper:143    SQL Error: 0, SQLState: 08S01
2014-11-14 17:39:44 [ERROR]SqlExceptionHelper:144   Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2014-11-14 17:39:44 [ERROR]BackupService:245    org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection

似乎Hibernate对我的工作来说有一个小的事务超时,但是我找不到默认的超时值。 我也没有在休眠文档中找到它,我找到了如何更改它,但是没有更改默认值。

这是我的休眠配置:

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <list>
                <value>com.test.db.entity</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                <prop key="hibernate.show_sql">false</prop>             
                <prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
                <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.search.autoregister_listeners">false</prop>
                <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>         
            </props>
        </property>
</bean>

您知道使用此配置的休眠事务的默认超时值是多少吗?

我有同样的例外。 我用Google搜索,发现您的问题没有答案:)

我在Weblogic Console上的“ mydomain-> Configuration-> JTA”上将“超时秒数”从300更改为1000(可能会增加,具体取决于您的事务超时),或者将应用程序服务器上的JTA超时增加。

然后,对于hibernate.cfg.xml,您可以检查以下答案: Hibernate / MySQL连接超时

有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM