Unofficial Content
  • This documentation is valid for:

JTA Support

Scope

Language: Java
Objects: Transactions, Procedures
Enviroment: Web
Access Technology: JDBC using JNDI Datasource



 

Introduction

A new way of managing LUW named JTA has been implemented for java web applications that connects to the database using a JNDI datasource
 

Description

One important benefit of this feature is that supports distributed transactions.
For example, let's see what happen in the following scenario: the model acceses two (or more) data stores, and a commit is performed, then the commit will be executed first in database 1 and then in database 2. If everything is ok, the transaction ends. Now, what happen if an error occurs in database 2? With JTA, if an error occurs, then the rollback will be done in _both_ databases. On the other hand, without JTA, the commit on database 1 was definitly done and the rollback will be done just in database 2.
 

Requirements

You need to set Enable Distributed Transactions property.

Besides, there are some conditions in order to use JTA:

The web application must use a datasource of the server to connect to the database.
In dbms options, the option 'Use datasource for web based applications' must be set to Yes, and a jndi name , defined in the server must be given.

The server must have JTA support.
Any J2EE server has JTA support, for example Websphere , Oracle Application Server, etc.
Others application server, like Jakarta - Tomcat is not capable, however there are classes with the necessary JTA support that can be added to the classpath in order to use it. It can be downloaded from the Sun's Site.
 

Intresting Links

How to create a JDBC Datasource
Internet Paper: Understanding JTA
How the LUW is managed in EJBs
 

Comments & Collaboration
 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant