You can configure two resource reference files on the same
data source. This allows you to extend the custom properties for the
data source to be extended to include two different schema names (currentSQLId
on z/OS® or currentSchema name in the custom properties)
that can be used to exploit the capabilities of the application server.
About this task
When an EntityManager is created, the application server
obtains a connection to the database. When you are using a pessimistic
transaction, the EntityManager will retain that connection until the
EntityManager is closed. When there are two EntityManagers that extend
the data source definitions, the
openjpa.jdbc.TransactionIsolation property
might cause a problem with the transaction. This property can be found
in the
persistence.xml file in the following entry:
property name="openjpa.jdbc.TransactionIsolation" value="read-committed"
In
order to satisfy this request, Java Persistence
API (JPA) will obtain a connection and immediately call
setTransactionIsolation(READ_COMMITTED).
When you have two EntityManagers share a single physical connection
to the database, the first EntityManager creates a connection to the
database and involves that connection in a transaction. When the second
EntityManager creates a connection, it is not able to change the isolation
level.
You can avoid this problem by creating two resource reference
files in the same data source. You can create the resource references
with Rational
® Application Developer or by editing
the XML files. You will need to make changes to the
ejb-jar.xml,
ibm-ejb-jar-bnd.xml,
ibm-ejb-jar-ext.xml,
persistence.xml files.
Note: For IBM Optim pureQuery Runtime,
if this is an XA data source you must define a new custom property
on the data source where property_name = downgradeHoldCursorsUnderXa and
boolean value = true.
See the following
sections for information on how to accomplish this: