hibernate事务管理器

时间:2013-01-07 11:34:48

标签: spring hibernate jboss transactionmanager

我使用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!

我应该担心吗?所有数据都存储在db(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>

  - &GT;   - &GT;   - &GT;

<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" />

提前致谢。

1 个答案:

答案 0 :(得分:0)

你可以试试这个 -

<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