Top Description Methods
javax.persistence

public @Interface PersistenceContext

extends Annotation
Annotations
@Repeatable:PersistenceContexts
@Target:TYPE, METHOD, FIELD
@Retention:RUNTIME
Imports
java.lang.annotation.Repeatable, .Target, .Retention

Expresses a dependency on a container-managed EntityManager and its associated persistence context.
Since
Java Persistence 1.0

Method Summary

Modifier and TypeMethod and Description
public String
name()

(Optional) The name by which the entity manager is to be accessed in the environment referencing context; not needed when dependency injection is used.

public PersistenceProperty[]
properties()

(Optional) Properties for the container or persistence provider.

public SynchronizationType
synchronization()

(Optional) Specifies whether the persistence context is always automatically synchronized with the current transaction or whether the persistence context must be explicitly joined to the current transaction by means of the EntityManager joinTransaction method.

public PersistenceContextType
type()

(Optional) Specifies whether a transaction-scoped persistence context or an extended persistence context is to be used.

public String
unitName()

(Optional) The name of the persistence unit as defined in the persistence.xml file.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

nameback to summary
public String name()

(Optional) The name by which the entity manager is to be accessed in the environment referencing context; not needed when dependency injection is used.

propertiesback to summary
public PersistenceProperty[] properties()

(Optional) Properties for the container or persistence provider. Vendor specific properties may be included in this set of properties. Properties that are not recognized by a vendor are ignored.

synchronizationback to summary
public SynchronizationType synchronization()

(Optional) Specifies whether the persistence context is always automatically synchronized with the current transaction or whether the persistence context must be explicitly joined to the current transaction by means of the EntityManager joinTransaction method.

Since
Java Persistence 2.1
typeback to summary
public PersistenceContextType type()

(Optional) Specifies whether a transaction-scoped persistence context or an extended persistence context is to be used.

unitNameback to summary
public String unitName()

(Optional) The name of the persistence unit as defined in the persistence.xml file. If the unitName element is specified, the persistence unit for the entity manager that is accessible in JNDI must have the same name.