Hitachi

uCosminexus Application Server Compatibility Guide


8.12.42 @PersistenceUnit

Organization of this subsection

(1) Description

This annotation defines the reference of the EntityManagerFactory. This annotation is added to the class to be looked up.

The applicable targets are class, method, and field.

(2) Element

The following table lists the elements of @PersistenceUnit:

Element name

Optional/Required

Element description

name

Optional

This element specifies the lookup name of the EntityManagerFactory.

unitName

Optional

This element specifies the name of the persistence unit defined in the persistence.xml file.

The details of attributes supported with Cosminexus JPA provider are as follows:

(a) name element

Type

String

Description

This element specifies the lookup name of the EntityManagerFactory. This element specifies the name of the EntityManagerFactory to be registered in the JNDI name space.

The value that can be specified is a character string.

You are not required to specify this element when using a DI.

Default value

Null character string

(b) unitName element

Type

String

Description

This element specifies the name of the persistence unit defined in the persistence.xml file.

When the unitName element is specified, set the same name for the persistence unit used by EntityManagerFactory that can be accessed by the JNDI name space.

Default value

Null character string