> 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

Reply via email to