users@glassfish.java.net

how to get transaction id in glassfish?

From: <glassfish_at_javadesktop.org>
Date: Thu, 28 Aug 2008 14:24:41 PDT

Hi,

I'm not an EJB expert. So I'm trying to migrate the following code from weblogic to glassfish.
import weblogic.transaction.Transaction;
import weblogic.transaction.TransactionManager;
.....
    try
    {
      Context context = new InitialContext();

      TransactionManager tm = (TransactionManager)context
          .lookup( "weblogic.transaction.TransactionManager" );
      Transaction transaction = (Transaction)tm.getTransaction();

      transactionId = Hex.encode( transaction.getXid().getGlobalTransactionId() );
    }

So this is what I did:
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
.............
TransactionManager tm=context.lookup("java:appserver/TransactionManager");
Transaction transaction = (Transaction)tm.getTransaction();

I don't know how to proceed from this point as the javax.transaction.Transaction interface doesn't have a getXid() method.

Thanks
Suneel
[Message sent by forum member 'suneelgv' (suneelgv)]

http://forums.java.net/jive/thread.jspa?messageID=296026