uCosminexus Application Server, API Reference Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
(1) Description
This annotation defines the reference of a container-managed EntityManager. 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 @PersistenceContext:
| Element name |
Optional/Required |
Element description |
| name |
Optional |
This element specifies the lookup name of the EntityManager. |
| unitName |
Optional |
This element specifies the name of the persistence unit defined in the persistence.xml file. |
| type |
Optional |
This element specifies the type of lifecycle of the persistence context. |
| properties |
Optional |
This element specifies the vendor--dependent properties specified in @PersistenceProperty. |
The details of attributes that are supported with Cosminexus JPA provider are as follows:
(a) name element
- Type
- String
- Description
- This element specifies the lookup name of the EntityManager.
- 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
(c) type element
- Type
- PersistenceContextType
- Description
- This element specifies the type of lifecycle of the persistence context.
- The following two types of values can be specified:
- TRANSACTION: Persistence context of the transaction scope
- EXTENDED: Extended persistence context
- Default value
- TRANSACTION
(d) properties element
- Type
- PersistenceProperty[]
- Description
- This element specifies the vendor-dependent properties of the JPA Provider specified in @PersistenceProperty.
- You can specify the value within the specifiable range of the arrays of @PersistenceProperty. For details, see 2.7.41 @PersistenceProperty.
- When the properties element is specified, the properties that cannot be recognized are ignored.
- Default value
- Blank array
All Rights Reserved. Copyright (C) 2012, 2013, Hitachi, Ltd.