Announcement Announcement Module
Collapse
No announcement yet.
Using SessionFactoryUtils but session is not closing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using SessionFactoryUtils but session is not closing

    I have run across a scenario where I can't seem to get Spring to close the hibernate session that's attached to a JTA transaction. I'm using the Spring Hibernate template's .save() mechanism, and I see it attach in the log as follows:

    Code:
    19:39:48,571 DEBUG SessionFactoryUtils:329 - Opening Hibernate session
    19:39:48,571 DEBUG SessionImpl:555 - opened session
    19:39:48,571 DEBUG SessionFactoryUtils:357 - Registering JTA transaction synchronization for new Hibernate session
    19:39:48,571 DEBUG TransactionSynchronizationManager:142 - Bound value [org.springframework.orm.hibernate.SessionHolder@1c19925] for key [net.sf.hibernate.impl.SessionFactoryImpl@356519] to thread [ExecuteThread: '13' for queue: 'weblogic.kernel.Default']
    19:39:48,571 DEBUG HibernateInterceptor:152 - Found thread-bound session for Hibernate interceptor
    19:39:48,571 DEBUG TransactionSynchronizationManager:117 - Retrieved value [org.springframework.orm.hibernate.SessionHolder@1c19925] for key [net.sf.hibernate.impl.SessionFactoryImpl@356519] bound to thread [ExecuteThread: '13' for queue: 'weblogic.kernel.Default']
    Unfortunately, I do see the usually "DEBUG SessionFactoryUtils:572 - Closing Hibernate session" at the end of the transaction. Does anyone know why this might be happening or how it could happen? I have all the proper configuration as per below. Different from what I have done in the past is that the transaction is implicitly demarcated using BEAs JPD. But the funny thing is, I see the commit (in the database and in the log), however no session close!

    Code:
    19:39:49,289 DEBUG SessionImpl:2359 - executing flush
    19:39:49,289 DEBUG SessionImpl:2824 - post flush
    19:39:49,289 DEBUG CacheSynchronization:24 - transaction before completion callback
    19:39:49,446 DEBUG JpdContainer:41 - TxnListener AC(BEA1-01A2ED9B3D3E) status=3 str.val.(?)=STATUS_COMMITTED
    Any help would be greatly appreciated!

    Lou

    Pertinent Files :

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
        <bean id="tlvDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName"><value>tlvDataSource</value></property>
        </bean>
    
    	<bean id="valReqSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="tlvDataSource"/></property>
            <property name="configLocation"><value>classpath&#58;ValuationRequest.hibernate.cfg.xml</value></property>
    	</bean>
    
    	<!-- ========================= DAO DEFINITIONS ========================= -->
    
    <bean id="ValuationRequestHibernateInterceptor"             class="org.springframework.orm.hibernate.HibernateInterceptor">
                <property name="sessionFactory">
                      <ref bean="valReqSessionFactory"/>
                </property>
          </bean>
    
        <!-- Valuation -->
    	<bean id="ValuationRequestDAOTarget" singleton="true"
            class="com.mitchell.services.business.valuation.dao.hibernate.ValuationRequestHibernateDAO">
            <property name="sessionFactory">
                <ref local="valReqSessionFactory"/>
            </property>        
        </bean>
        <bean id="com.mitchell.services.business.valuation.dao.ValuationRequestDAO" singleton="true"
            class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="proxyInterfaces">
                      <value>com.mitchell.services.business.valuation.dao.ValuationRequestDAO</value>
                </property>
                <property name="interceptorNames">
                      <list>                        
                            <value>ValuationRequestHibernateInterceptor</value>
                            <value>ValuationRequestDAOTarget</value>
                      </list>
                </property>        
        </bean>
    </beans>
    Code:
    <hibernate-configuration>
    	<session-factory name="tlvSessionFactory">
    		<!-- dialect for Oracle 9 -->
    		<property name="hibernate.dialect">
    			net.sf.hibernate.dialect.Oracle9Dialect
    		</property>
    		<property name="hibernate.max_fetch_depth">3</property>
    		<!--The following is deprecated in favor of max_fetch_depth above
    		<property name="hibernate.use_outer_join">true</property>-->
    		<property name="hibernate.jdbc.batch_size">0</property>
    		<property name="hibernate.jdbc.use_get_generated_keys">true</property>
    		<property name="hibernate.jdbc.use_streams_for_binary">true</property>
    		<property name="hibernate.show_sql">false</property>
    		<property name="hibernate.cglib.use_reflection_optimizer">true</property>
    		<property name="hibernate.query.substitutions">
    			true 'T', false 'F', yes 'Y', no 'N'
    		</property>
            <property name="hibernate.transaction.manager_lookup_class">
    			net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
    		</property>
            
            <!-- Valuation -->
    		<mapping resource="com/mitchell/services/business/valuation/dto/CompVehicleReportsDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/ProfileDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/SettlementDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/SettlementFormsDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/SettlementFormTypeDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/ValuationRequestDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/ValuationStatusDTO.hbm.xml" />
            
    		<mapping resource="com/mitchell/services/business/valuation/dto/VehicleDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/VehicleInspectionDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/VehicleOptionDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/PointOfImpactDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/AdjustmentCategoriesDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/AdjustmentsDTO.hbm.xml" />
    
    		<mapping resource="com/mitchell/services/business/valuation/dto/VehicleConditionDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/ConditionCategoryDTO.hbm.xml" />
    		<mapping resource="com/mitchell/services/business/valuation/dto/ConditionRatingDTO.hbm.xml" />
    
       </session-factory>
    </hibernate-configuration>

  • #2
    URGENT NEED!!

    Please if anyone has any idea. It's starting to become a question by our management whether to continue to use Spring.

    Thank you!
    Lou

    Comment


    • #3
      Just an FYI...this was fixed by Juergen per the following SPR:

      http://opensource.atlassian.com/proj...browse/SPR-532

      Comment

      Working...
      X