-->
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.  [ 2 posts ] 
Author Message
 Post subject: Rollbacks not occuring with XA datasource on WAS 6.0
PostPosted: Mon Apr 12, 2010 1:38 pm 
Beginner
Beginner

Joined: Sun Oct 14, 2007 7:29 pm
Posts: 23
Hello,

I had everything working great in my WebSphere Application Server 6.0 instance with DB2 V8.1 and Hibernate 3 with a non-XA data source using WAS's JTA. Rollbacks were working fine in my stateless session beans whenever an exception was thrown.

However, due to a limitation in WAS, I needed to change my data source to an XA type, which I did and verified that the connection was working okay. Now I am still able to run queries, update entities, etc, via Hibernate and the XA based data source, but rollbacks are not working and Exceptions are not being handled as they should in my stateless session beans.

I noticed that when one of my DAOs caught a valid RuntimeException from Hibernate and threw a custom Exception to the calling stateless session bean, instead of the bean’s exception block catching the exception from the DAO, it went directly to the finally block. In addition, it did NOT roll back the database changes made thus far – major issue. I also noticed a warning reported from Hibernate’s AbstractBatcher occasionally when a session closes, stating that I may have left a result set open, but from what I read (can’t find the article right now), it was simply an issue in the log and shouldn’t be a concern.

The lack of roll-backs, even when I issue a session.getTransaction().rollback(), does concern me though. Do I need to make further mods to my Hibernate config file below? Am I missing something?


Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
             <property name="hibernate.connection.datasource">java:comp/env/fawebdbprod</property>         
             <property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>
             <property name="hibernate.default_schema">faweb</property>

   <property name="hibernate.show_sql">true</property>
   <property name="hibernate.format_sql">true</property>

             <property name="jdbc.use_streams_for_binary">true</property>
             <property name="hibernate.max_fetch_depth">3</property>
             <property name="hibernate.default_batch_fetch_size">8</property>               
             <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
             <property name="hibernate.transaction.manager_lookup_class">
         org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
        
             <property name="current_session_context_class">jta</property>
             <property name="hibernate.transaction.flush_before_completion">true</property>
             <property name="hibernate.transaction.auto_close_session">true</property>

   <property name="hibernate.connection.isolation">2</property>

             <property name="hibernate.connection.release_mode">on_close</property>

             <property name="hibernate.jndi.url">iiop://localhost:2809/</property>
             <property name="hibernate.jndi.class">com.ibm.websphere.naming.WsnInitialContextFactory</property>   
   <property name="hibernate.session_factory_name">/faweb/HibernateSessionFactory</property>
   <property name="hibernate.generate_statistics">true</property>
   <property name="hibernate.jdbc.use_get_generated_keys">true</property>

      <mapping resource="Actcat.hbm.xml"/>
      <mapping resource="Actdep.hbm.xml"/>
                            .......................
      <mapping resource="Usrprofiles.hbm.xml"/>
      <mapping resource="Usrroles.hbm.xml"/>      
<!--            <property name="hibernate.hbm2ddl.auto" value="create"/>-->
    </session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject: Re: Rollbacks not occuring with XA datasource on WAS 6.0
PostPosted: Mon Apr 12, 2010 11:09 pm 
Beginner
Beginner

Joined: Sun Oct 14, 2007 7:29 pm
Posts: 23
The warning/info message I am receiving at the end of transactions is as follows:

    ConnectionMan I org.hibernate.jdbc.ConnectionManager afterTransaction forcing batcher resource cleanup on transaction completion; forgot to close ScrollableResults/Iterator?


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

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.