openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcin Kwapisz" <mkwap...@zsk.p.lodz.pl>
Subject RE: Propblem with OpenEJB + Toplink unit tests
Date Mon, 04 Aug 2008 12:45:17 GMT
> It may be that TopLink doesn't know how to find our
> TransactionManager.  OpenJPA finds it automatically by calling
> org.apache.openejb.OpenEJB.getTransactionManager().  For Hibernate,
> there's the TransactionManagerLookup which can be configured.  Do you
> know if there's anything similar in TopLink?
> 
[Marcin Kwapisz] 
Thanks David for the hint.

There is such feature and similar problem (solution also) is described here:
http://forums.oracle.com/forums/thread.jspa?threadID=625250&tstart=0&messageID=2390496
and here:
http://www.jroller.com/guruwons/entry/use_glassfish_java_persistence_provider

The only one thing I had to find was TransactionManager jndi name: java:comp/TransactionManager

public class OpenEJBTransactionController extends JTATransactionController
{

    public static final String JNDI_TRANSACTION_MANAGER_NAME = "java:comp/TransactionManager";
    
    public OpenEJBTransactionController()
    {
        super();
    }
    
    @Override
    protected TransactionManager acquireTransactionManager() throws Exception
    {
        return (TransactionManager) jndiLookup(JNDI_TRANSACTION_MANAGER_NAME);
    }
}

and in persistence.xml

<property name="toplink.target-server" value="pl.zsk.samples.ejbservice.OpenEJBTransactionController"/>

Regards
-- 
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland


Mime
View raw message