-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: commit of inner transaction ignored
PostPosted: Thu Aug 24, 2006 1:58 am 
Newbie

Joined: Thu Aug 24, 2006 1:12 am
Posts: 1
Hibernate version:Hibernate 3.2.0.cr2
Name and version of the database you are using: Oracle 9i
App Server: Websphere 6.1
Other Config: Spring 2.0-rc2

Hi all,

I am trying (without success) to commit an inner transaction which is declared via CMT on a SSB as RequiresNew. At runtime this txn exists within the context of a global txn (outer CMT).

I have remotely debugged my way through this and identified the problem as the inner txn is never comitted independently - the db is not updated until the outer txn commits, hence the container seems to be basically ignoring it when it should be committing. Conversely, if I change the inner txn type (CMT) in the deployment descriptor to NEVER the correct exception is thrown by the container stating this txn cannot exist within a global txn - so the container is trying to begin a new (inner) transaction at the correct location.

Our current configuration for all beans, commands, dao's and hibernate is wired up through Spring. I have tried to get the most simplistic JTA config here, so I am directly configuring all JTA management to hibernate (ie: bypassing any spring JTA config). My spring application context hibernate is in the code block below.

I have a couple of theories here that someone may be able to clarify.


1. From the WebSphereTransactionManagerLookup source I have noticed that the there is no specific TransactionManagerFactory class for Websphere 6.1, rather just versions 4, 5, and 5.1. I have read that the 5.1 factory works for WS6.0 but there is no documentation regarding WS6.1. Could this be the reason why suspended txns aren't working with Websphere 6.1?

2. I have read through the standard hibernate doco regarding transactions, sessions and contextual sessions, however I cannot find any doc regarding suspended transactions using CMT. Specifically, is there anything I have to do to ensure a second hibernate session is kicked off for the inner transaction while the outer transaction (which is bound to the first session) is suspended.

Is this the correct understanding? If the outer txn is suspended we would want to start a new session for the inner txn, as you could not create and commit a new txn on the same session - committing the contents of the outer txn session prior to its completion would surely be invalid.

Any help on this would be greatly appreciated.

Damian Phillips




Code:
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource" ref="ecDataSource" />
      <property name="configLocation" value="classpath:resource/hibernate.cfg.xml" />
      <property name="lobHandler" ref="myLobHandler" />
      <property name="hibernateProperties">
         <props>
            <!-- Database Settings -->
            <prop key="hibernate.default_schema">alex</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
            
            <!-- JDBC Settings -->
            <prop key="hibernate.jdbc.use_streams_for_binary">true</prop>
            <prop key="hibernate.max_fetch_depth">1</prop>
            
            <!-- Cache settings -->
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
            
            <!-- Transaction Support -->
            <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereTransactionManagerLookup</prop>
            <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</prop>
            <prop key="hibernate.current_session_context_class">thread</prop>
            <prop key="transaction.auto_close_session">true</prop>
            <prop key="transaction.flush_before_completion">true</prop>
         </props>
      </property>
   </bean>


   <bean id="ecDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:comp/env/jdbc/lx" />
   </bean>

   <bean id="myNativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor" />

   <bean id="myLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler">
      <property name="nativeJdbcExtractor" ref="myNativeJdbcExtractor" />
   </bean>

   <bean id="myHibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
      <property name="sessionFactory" ref="mySessionFactory" />
   </bean>



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.