8.11.3 Items checked when the application is deployed
The following items are checked when an application using the JPA is deployed on the J2EE server:
-
Checking the persistence unit definitions
-
Checking the EntityManager and EntityManagerFactory references
The following is a description of the checks:
- Organization of this subsection
(1) Checking of the persistence unit definition
The following points describe the contents checked in the persistence unit definition:
(a) Validation of persistence.xml
Validates whether persistence.xml included in the application is in accordance with the persistence_1_0.xsd schema. If an error is found during the validation, the error message KDJE56526-E is output and the deployment is cancelled.
(b) Checking of the persistence unit name
Checks whether the persistence unit name is null. If the persistence unit name is null, the error message KDJE56505-E is output and the deployment is cancelled.
Also, checks whether persistence units with duplicated names are defined in the application EAR files or in one EJB-JAR or WAR. If persistence units with duplicated names are defined, a warning message KDJE56500-W is output and the deployment continues. Note that in this case, only one persistence unit is actually deployed.
(c) Checking whether the data source referenced by the persistence unit exists
The contents checked differ depending on the transaction type of the persistence unit.
-
When the transaction type of the persistence unit is the JTA
The following table lists the contents checked and the operations to be performed when an error occurs during the check.
Table 8‒10: Checked contents and operations to be performed when an error occurs during the check (for the JTA transaction type) Checked contents
Operations when an error occurs during the check
The JTA data source (the data source specified in the <jta-data-source> tag of persistence.xml or the default value specified in the system properties) used in the persistence unit is specified.
The error message KDJE56527-E is output and the deployment is cancelled.
The resource adapter that provides the JTA data source exists.
The error message KDJE56529-E is output and the deployment is cancelled.
The resource adapter that provides the JTA data source is running.
The transaction support level of the resource adapter is LocalTransaction or XATransaction.
The error message KDJE56531-E is output and the deployment is cancelled.
The connection factory interface of the resource adapter is javax.sql.DataSource.
The error message KDJE56533-E is output and the deployment is cancelled.
-
When the transaction type of the persistence unit is RESOURCE_LOCAL
The following table lists the contents checked and the operations to be performed when an error occurs during the check.
Table 8‒11: Checked contents and operations to be performed when an error occurs during the check (for the RESOURCE_LOCAL transaction type) Checked contents
Operations when an error occurs during the check
The non-JTA data source (the data source specified in the <non-jta-data-source> tag of persistence.xml or the default value specified in the system properties) used in the persistence unit is specified.
The error message KDJE56528-E is output and the deployment is cancelled.
The resource adapter that provides the non-JTA data source exists.
The error message KDJE56530-E is output and the deployment is cancelled.
The resource adapter that provides the non-JTA data source is running.
The transaction support level of the resource adapter is NoTransaction.
The error message KDJE56532-E is output and the deployment is cancelled.
The connection factory interface of the resource adapter is javax.sql.DataSource.
The error message KDJE56533-E is output and the deployment is cancelled.
(d) Checking the provider class specified in the persistence unit
Checks whether the JPA provider class (class specified in the <provider> tag of persistence.xml) used by the persistence unit can be loaded from the application. If the loading of the class fails, the error message KDJE56503-E is output and the deployment is cancelled.
(e) Checking whether the JAR file referenced by the persistence unit exists
Checks whether the JAR file (JAR file specified in the <jar-file> tag of persistence.xml) referenced by the persistence unit exists. If the JAR file does not exist, the error message KDJE56506-E is output and the deployment is cancelled.
(f) Checking the contents defined in the persistence unit using the JPA provider
The JPA provider generates the persistence unit from the contents of persistence.xml parsed by the JPA container. If the persistence unit definition has a problem and if the JPA provider returns an error, the error message (KDJE56539-E) is displayed and the deployment is cancelled.
(2) Checking the EntityManager and EntityManagerFactory references
The following points describe the contents checked in the EntityManager and EntityManagerFactory references:
(a) Checking the existence of the persistence unit
In the EntityManager and EntityManagerFactory references defined in the EJB and Web components, check whether the specified persistence unit name is an actually referable persistence unit name. Also, if the persistence unit name is omitted, check whether the persistence unit to be used can be identified. If an error is found in this check, the error message KDJE56501-E is output and the deployment is cancelled.
(b) Checking the transaction type for the container-managed EntityManager
Check whether the transaction type of the persistence unit is the JTA when the container-managed EntityManager is used. If an error occurs in this check, the error message KDJE56534-E is output and the deployment is cancelled.
(c) Checking if the extended persistence context is used from outside the Stateful Session Bean
When EXTENDED is specified as the persistence context type with the EntityManager references, check whether the location where the references are defined is the Stateful Session Bean. If the references are defined in a location other than the Stateful Session Beans, the error message KDJE56535-E is output and the deployment is cancelled.