Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 4.06 KB

README.adoc

File metadata and controls

90 lines (66 loc) · 4.06 KB

bmt: Bean Managed Transactions with JPA and JTA

The bmt quickstart demonstrates Bean-Managed Transactions (BMT), showing how to manually manage transaction demarcation while accessing JPA entities.

What is it?

The bmt quickstart demonstrates how to manually manage transaction demarcation while accessing JPA entities in {productNameFull}.

On occasion, the application developer requires finer grained control over the lifecycle of JTA transactions and JPA Entity Managers than the defaults provided by the Jakarta EE container. This example shows how the developer can override these defaults and take control of aspects of the lifecycle of JPA and transactions.

When you run this example, you are presented with a Use bean managed Entity Managers checkbox.

  • If you check the checkbox, it shows the developer responsibilities when injecting an Entity Manager into a managed (stateless) bean.

  • If you uncheck the checkbox, shows the developer responsibilities when using JPA and transactions with an unmanaged component.

This example shows how to transactionally insert key value pairs into the database and demonstrates the requirements on the developer with respect to the JPA Entity Manager.

Access the Application

The application will be running at the following URL: http://localhost:8080/{artifactId}/.

You are presented with a simple form for adding key/value pairs, and a checkbox to indicate whether the updates should be executed using an unmanaged component. Effectively this will run the transaction and JPA updates in the servlet, not session beans. If the box is checked then the updates are executed within a session bean method.

  1. To list all pairs leave the Key input field empty.

  2. To add or update the value of a key, fill in the Key and Value input fields.

  3. Click the Submit button to see the results.

Server Log: Expected Warnings and Errors

You will see the following warnings in the server log. You can ignore these warnings.

WFLYJCA0091: -ds.xml file deployments are deprecated. Support may be removed in a future version.

HHH000431: Unable to determine H2 database version, certain features may not work