Building a project with a persistence layer and transaction support for deployment in Karaf
Transaction support for your JPA-persisted data can be simply added by introducing Apache Aries JTA modules to your project. The JTA components provide a transaction manager that coordinates data storage and retrieval.
In the Building a project with a persistence layer for deployment in Karaf recipe, we learned how to use JPA and OpenJPA to build a simple application that persists recipes to a database using a RecipeBookService
class. In this recipe, we'll add container-based transaction management via JTA.
Getting ready
The ingredients of this recipe include the Apache Karaf distribution kit, access to JDK, and Internet connectivity. Sample code for this recipe is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter7/chapter7-recipe4. Generally, you'll also need to perform the steps outlined in the Building a project with a persistence layer for deployment in Karaf recipe...