Skip to content

Commit

Permalink
First pass at JTA (#169)
Browse files Browse the repository at this point in the history
* First pass at JTA

* applied feedback

Signed-off-by: Guillermo González de Agüero <z06.guillermo@gmail.com>
  • Loading branch information
ggam authored and bshannon committed Sep 17, 2019
1 parent e1b9fce commit de294f7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions src/main/jbake/content/transactions002.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ In a Jakarta EE application, a transaction is a series of actions that must
all complete successfully, or else all the changes in each action are
backed out. Transactions end in either a commit or a rollback.

The Java Transaction API (JTA) allows applications to access
Jakarta Transactions allows applications to access
transactions in a manner that is independent of specific
implementations. JTA specifies standard Java interfaces between a
implementations. Jakarta Transactions specifies standard Java interfaces between a
transaction manager and the parties involved in a distributed
transaction system: the transactional application, the Jakarta EE server,
and the manager that controls access to the shared resources affected by
the transactions.

The JTA defines the `UserTransaction` interface that applications use to
Jakarta Transactions defines the `UserTransaction` interface that applications use to
start, commit, or roll back transactions. Application components get a
`UserTransaction` object through a JNDI lookup by using the name
`java:comp/UserTransaction` or by requesting injection of a
`UserTransaction` object. An application server uses a number of
JTA-defined interfaces to communicate with a transaction manager; a
transaction manager uses JTA-defined interfaces to interact with a
Jakarta Transactions defined interfaces to communicate with a transaction manager; a
transaction manager uses Jakarta Transactions defined interfaces to interact with a
resource manager.

The JTA 1.2 specification is available at
`http://jcp.org/en/jsr/detail?id=907`.
The Jakarta Transactions 1.3 specification is available at
`https://jakarta.ee/specifications/transactions/1.3/`.


2 changes: 1 addition & 1 deletion src/main/jbake/content/transactions004.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Container-Managed Transactions
------------------------------

In an enterprise bean with container-managed transaction demarcation,
the EJB container sets the boundaries of the transactions. You can use
the enterprise bean container sets the boundaries of the transactions. You can use
container-managed transactions with any type of enterprise bean: session
or message-driven. Container-managed transactions simplify development
because the enterprise bean code does not explicitly mark the
Expand Down
18 changes: 9 additions & 9 deletions src/main/jbake/content/transactions005.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@ begin transaction

When coding an application-managed transaction for session or
message-driven beans, you must decide whether to use Java Database
Connectivity or JTA transactions. The sections that follow discuss both
Connectivity or Jakarta transactions. The sections that follow discuss both
types of transactions.

[[BNCIZ]][[jta-transactions]]

JTA Transactions
~~~~~~~~~~~~~~~~
Jakarta Transactions
~~~~~~~~~~~~~~~~~~~~

JTA, or the Java Transaction API, allows you to demarcate transactions
Jakarta Transactions allows you to demarcate transactions
in a manner that is independent of the transaction manager
implementation. GlassFish Server implements the transaction manager with
the Java Transaction Service (JTS). However, your code doesn't call the
JTS methods directly but instead invokes the JTA methods, which then
JTS methods directly but instead invokes the Jakarta Transactions methods, which then
call the lower-level JTS routines.

A JTA transaction is controlled by the Jakarta EE transaction manager. You
may want to use a JTA transaction because it can span updates to
A Jakarta transaction is controlled by the Jakarta EE transaction manager. You
may want to use a Jakarta transaction because it can span updates to
multiple databases from different vendors. A particular DBMS's
transaction manager may not work with heterogeneous databases. However,
the Jakarta EE transaction manager does have one limitation: It does not
support nested transactions. In other words, it cannot start a
transaction for an instance until the preceding transaction has ended.

To demarcate a JTA transaction, you invoke the `begin`, `commit`, and
To demarcate a Jakarta transaction, you invoke the `begin`, `commit`, and
`rollback` methods of the `javax.transaction.UserTransaction` interface.

[[BNCJA]][[returning-without-committing]]
Expand All @@ -80,7 +80,7 @@ In a stateless session bean with bean-managed transactions, a business
method must commit or roll back a transaction before returning. However,
a stateful session bean does not have this restriction.

In a stateful session bean with a JTA transaction, the association
In a stateful session bean with a Jakarta transaction, the association
between the bean instance and the transaction is retained across
multiple client calls. Even if each business method called by the client
opens and closes the database connection, the association is retained
Expand Down
4 changes: 2 additions & 2 deletions src/main/jbake/content/transactions006.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For container-managed transactions, you can use the Administration
Console to configure the transaction timeout interval. See
link:usingexamples003.html#BNADJ[Starting the Administration Console].

For enterprise beans with bean-managed JTA transactions, you invoke the
For enterprise beans with bean-managed Jakarta transactions, you invoke the
`setTransactionTimeout` method of the `UserTransaction` interface.

[[sthref237]][[to-set-a-transaction-timeout]]
Expand All @@ -30,7 +30,7 @@ expand the server-config node and select Transaction Service.
Timeout field to the value of your choice (for example, 5).
+
With this setting, if the transaction has not completed within 5
seconds, the EJB container rolls it back.
seconds, the enterprise bean container rolls it back.
+
The default value is 0, meaning that the transaction will not time out.
3. Click Save.
Expand Down
2 changes: 1 addition & 1 deletion src/main/jbake/content/transactions008.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ You can demarcate a transaction in a web component by using either the
interface. These are the same interfaces that a session bean with
bean-managed transactions can use. Transactions demarcated with the
`UserTransaction` interface are discussed in
link:transactions005.html#BNCIZ[JTA Transactions].
link:transactions005.html#BNCIZ[Jakarta Transactions].


4 changes: 2 additions & 2 deletions src/main/jbake/content/transactions009.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Further Information about Transactions
Further Information about Transactions
--------------------------------------

For more information about transactions, see the Java Transaction API
1.2 specification at `https://www.jcp.org/en/jsr/detail?id=907`.
For more information about transactions, see the Jakarta Transactions
1.3 specification at `https://jakarta.ee/specifications/transactions/1.3/`.


0 comments on commit de294f7

Please sign in to comment.