Introduction
Your applications will commonly need to safely persist data and make use of transactional behaviors. A preferred way to accomplish this for Java developers is to use the Java Persistence API (JPA) and Java Transaction API (JTA). In the context of Apache Karaf, developers will use an OSGi-ready JPA implementation, such as Apache OpenJPA, EclipseLink, or Hibernate and the Apache Aries JTA.
This book will use OpenJPA as an implementation of the JPA specification for the transparent persistence of Java objects. In relation to OSGi containers, it provides container-managed persistence for the Blueprint container.
The Apache Aries JTA provides a transaction management service to the container. Using this service, developers can build applications requiring the following transactional flow:
getTransaction() begin() // demark beginning of transaction doWork() // your business logic if (rollback) then rollback() else commit()
The previous pseudo code outlines the general form of a transaction...