JTA Configuration

TopLink J2EE integration includes support for JTA external connection pools and external transaction controllers. To enable a JTA external transaction controller, you must set the login to use an external transaction controller, and configure the following in your Sessions XML file:

Example B-20 Configuring for JTA in Sessions XML

<session>
    ...
    <login>
        ...
        <uses-external-transaction-controller>true</uses-external-transaction-controller>
        <data-source>jdbc/MyApplicationDS</data-source>
        <uses-external-connection-pool>true</uses-external-connection-pool>
        ...
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    ...
</session>

Example B-21 Configuring for JTA in Code

DatabaseLogin login = null;
project = null;

/*note that useExternalConnectionPooling and useExternalTransactionController must be set before Session is created */
project = new SomeProject();
login = project.getLogin();
login.useExternalConnectionPooling();
login.useExternalTransactionController();

/* usually, other login configuration such as user, password, JDBC URL comes from the project but these can also be set here
session = new Session(project);

/* other session configuration, as necessary: logging, ETC
session.SetExternalTransactionController(new SomeJTSExternalTransactionController());
session.login();


Related Topics

Navigating the Sessions XML File
The XML Header
The <toplink-configuration> Element
The <session-broker> Element
The <session> Element

 

Copyright © 1997, 2004, Oracle. All rights reserved.