Information Technology Reference
In-Depth Information
<dependency>
<groupId>org.codehaus.btm</groupId>
<artifactId>btm</artifactId>
<version>2.1.4</version>
</dependency>
As you can see, each dependency has a different purpose. The
hibernate-
jpa-2.0-api
defines the interfaces (the internal contract) of the JPA 2.0 specification.
The actual implementation of said specification is provided by the
hibernate-core
dependency. We also need to provide a dependency for our data source and transaction
manager (in our case, a simple test case, we can use
h2
as an in-memory database and
btm
for the transaction manager). The jBPM6 management of the JPA persistence is done
thanks to the classes we previously mentioned implemented in the
jbpm-
persistence-jpa
dependency.
Once we have the dependencies, we need to define the required component configuration
for each one of them. Let's start with JPA/hibernate, where the configuration we will need
to add is the specific persistence unit that defines entities that should be mapped to our
database. The most basic content that needs to be added to the
META-INF/persist-
ence.xml
file in our classpath, as shown in the following code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" ...>
<persistence-unit name="org.jbpm.persistence.jpa"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/testDS</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>
org.jbpm.persistence.processinstance.ProcessInstanceInfo
</class>
<class>
org.jbpm.persistence.correlation.CorrelationPropertyInfo
</class>