+

Search Tips   |   Advanced Search

Set two resource reference files on the same data source


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 appserver.

When an EntityManager is created, the appserver obtains a connection to the database. When 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 we 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. We can avoid this problem by creating two resource reference files in the same data source. We 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.

For pureQuery, if this is an XA data source 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:

 

 

Related tasks


Extend DB2 data source definitions at the application level