12.3.5 Changes in JPA
- Organization of this subsection
(1) Abolition of the CJPA provider
The conventional CJPA provider cannot be used because it does not support JPA 2.1 APIs. Instead, Application Server version 11 and Developer version 11 newly provide a JPA provider that supports JPA 2.1. However, Cosminexus's original functions provided by the conventional CJPA provider cannot be used. The following parameters are ignored even if they are specified.
-
Properties starting with cosminexus.jpa specified in the <property> tag in persistence.xml
-
Keys starting with cosminexus.jpa specified in the user property file for J2EE servers
-
Parameters starting with cosminexus.jpa specified for the logical J2EE server by the Smart Composer functionality
(2) Persistence units and persistence context of container management cannot be used
The JPA 2.1 support scope for Application Server version 11 and Developer version 11 does not support the JPA container functionality. For this reason, applications that assume the use of the following APIs and DD elements to obtain the persistence units and persistence context for container management cannot be migrated.
-
The javax.persistence.PersistenceUnit annotation
-
The javax.persistence.PersistenceContext annotation
-
The <persistence-unit-ref> element of DD
-
The <persistence-context-ref> element of DD
In addition, the following parameters cannot be specified:
-
Keys starting with ejbserver.jpa specified in the user property file for J2EE servers
-
Parameters starting with ejbserver.jpa specified for the logical J2EE server by the Smart Composer functionality
Acquisition of the EntityManagerFactory object can be substituted with the persistence unit for application management. In accordance with the JPA 2.1 specifications, obtain the EntityManagerFactory object by using the following implementation example.
EntityManagerFactory factory
= Persistence.createEntityManagerFactory("persistence-unit-name");
EntityManager manager = factory.createEntityManager();
(3) Changes in the database supported as the persistence destination
In the JPA 2.1 support scope for Application Server version 11 and Developer version 11, only the following database can be used as the persistence destination:
-
HiRDB version 10
If persistence to other databases is required, prepare a JPA provider library# corresponding to JPA 2.1 and the persistence destination database, and add it to the class path instead of the Cosminexus JPA 2.1 provider.
- #
-
EclipseLink, Hibernate JPA, or some other library