persistence@glassfish.java.net

Urgent: Toplink out-of-container with EJB3 and with own TransactionController but without JNDI

From: ali aslan <aliforummails_at_googlemail.com>
Date: Tue, 20 Jun 2006 10:22:32 +0200

Hi,

I need Help very urgent.

Is it possible to use toplink with my own transaction controller in a non
J2EE context without JNDI.

I have used a property to configure the toplink settings

    Properties getProperties() {

        properties = new Properties();
        properties.put(TopLinkProperties.TARGET_SERVER,
MyToplinkServerPlatform.class.getName());
        properties.put(TopLinkProperties.TARGET_DATABASE,
TargetDatabase.Oracle);
        properties.put("java.persistence.setup.config",
ToplinkSessionConfig.class.getName());
        properties.put(TopLinkProperties.SESSION_NAME, "MySession");
        properties.put("javax.persistence.PersistenceProvider", "
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider");
        properties.put("javax.persistence.provider", "
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider");

        return properties;


MyToplinkServerPlatform contains a class MyConnectionProvider which extends
JTATransactionController.


The error occurs in the class
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl in the
method updateLogins(Map m).
In this method the following code snippet shows that the Connector which I
have implemented and want to use will always be overwritten.

 // mainDatasource is guaranteed to be non null
 if(!(login.getConnector() instanceof JNDIConnector)) {
    JNDIConnector jndiConnector;
    if (mainDatasource instanceof DataSourceImpl) {
        //Bug5209363 Pass in the datasource name instead of the dummy
datasource
        jndiConnector = new
JNDIConnector(((DataSourceImpl)mainDatasource).getName());
    } else {
       jndiConnector = new JNDIConnector(mainDatasource);
    }
    login.setConnector(jndiConnector);
    login.setUsesExternalConnectionPooling(true);
 }


I hope anyone knows how to fix this.


With regards Ali