Information Technology Reference
In-Depth Information
<class>
org.jbpm.persistence.correlation.CorrelationKeyInfo
</class>
<properties>
...
</properties>
</persistence-unit>
</persistence>
Let's take some time to understand this file. It follows the JPA 2.0 standard XML notation
to define five entities (
SessionInfo
,
WorkItemInfo
,
ProcessInstanceInfo
,
CorrelationPropertyInfo
, and
CorrelationKeyInfo
), a provider (which is
defined in the
hibernate-core
dependency, called
HibernatePersistence
),
and a JTA data source (which we will implement using
btm
).
Since we are using JTA to define a transaction manager for our data sources, we need to
define a JNDI registry where the transactions are discovered. We can define that easily by
having a
jndi.properties
file within our classpath that defines, in our case, the
btm
naming registry, with the following content:
java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
From then onward, all other components are defined in our case through code. Specific-
ally, we will start a data source, use
btm
to start a transaction manager around that data
source, and start an entity manager factory (a class used by JPA to interact with our data-
base in runtime).
From inside our test cases, we define a method marked with the
@Before
JUnit annota-
tion in our
JPAPersistentProcessTest
class by using the following content:
private PoolingDataSource ds = null;
...
@Before
public void startUp() throws Exception {
ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS");
ds.setClassName(
"bitronix.tm.resource.jdbc.lrc.LrcXADataSource");