Hibernate事务管理器



我使用spring和hibernate在jboss环境中部署了一个web应用程序。问题是我的日志中一直有这样的消息:

12:28:44,895 FINE  [org.hibernate.jdbc.ConnectionManager] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!

我应该担心吗?所有的数据都正确地存储在数据库(oracle),一切似乎都很好。

这是我的配置(db相关):

<bean name="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>java:jboss/datasources/DbDS</value>
    </property>
</bean>
<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="annotatedClasses">
        <list>
            ..
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.connection.release_mode">auto</prop>
            <prop key="hibernate.transaction.auto_close_session">false</prop>
        </props>
    </property>
</bean>
<bean id="txManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="dataSource" ref="dataSource" />
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

-->-->——>

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView"></property>
    <property name="prefix" value="/WEB-INF/jsp/"></property>
    <property name="suffix" value=".jsp"></property>
</bean>
<bean
    class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean
    class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

你可以试试-

<prop key="hibernate.connection.release_mode">after_statement</prop>

另外,查看以下链接了解更多详细信息-

http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/transactions.html transactions-connection-release

相关内容

  • 没有找到相关文章

最新更新