-->
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: WebSphere 6 and customized transaction manager lookup
PostPosted: Thu Jun 21, 2007 10:29 am 
Newbie

Joined: Thu Jun 21, 2007 9:13 am
Posts: 1
Location: Stuttgart, Germany
Dear Community!

I'm using WebSphere 6.0.2.17 with a DB2 8.1 and Hibernate 3.2.4.SP1. My application which runs in an XA environment and simply receives JMS messages and updates an Entity in the DB. All happens in one transaction in an SSB, running Bean managed transaction demarcation.

The Hibernate config is using the following settings for the Session:

Code:

<property name="hibernate.transaction.factory_class">
    org.hibernate.transaction.JTATransactionFactory
</property>

<property name="hibernate.transaction.manager_lookup_class">
    org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>



I noticed after some problems with transactions that the current Hibernate implementation of the class org.hibernate.transaction.WebSphereExtendedJTATransactionLookup implements the javax.transaction.TransactionManager and javax.transaction.Transaction interfaces with its subclasses TransactionManagerAdapter and TransactionAdapter. These implementations - which are used by Hibernate for transaction demarcation - are throwing UnsupportedOperationException in every method of the interfaces (begin, commit, rollback etc.).

Is there actually a special reason for this? Since it draws all transaction management by the Hibernate transaction abstraction useless. All other Lookup-Classes (JBoss, WebLogic) do not do that.

Since I know that IBM uses a proprietary way to get the TransactionManager, I implemented my own Lookup-Class which is quite simple:

Code:
package some.where.over.the.rainbow;
import java.util.Properties;
import javax.transaction.TransactionManager;
import org.hibernate.HibernateException;
import org.hibernate.transaction.TransactionManagerLookup;

public class CustomizedWASJTATransactionLookup implements TransactionManagerLookup {

    public TransactionManager getTransactionManager(Properties props)
    throws HibernateException {

        //This actually gets the WAS TransactionManager
        return com.ibm.ws.Transaction.TransactionManagerFactory.getTransactionManager();

    }

    public String getUserTransactionName() {
        return "java:comp/UserTransaction";
    }
}


I did some tests for different cases, in CMT and BMT environments. I used the Hibernate abstraction API like:

Code:
   Transaction tx = hibernateSession.beginTransaction();
   [... DO SOME STUFF ...]
   tx.commit() || tx.rollback();


Everything worked fine.

Now what I would like to know is (just to be sure), does anybody see any problems with this approach?

Any comments appreciated! Thank you.

Kind Regards.


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.