Annotation Interface PersistenceAgent
@Repeatable(PersistenceAgents.class)
@Target({TYPE,METHOD,FIELD})
@Retention(RUNTIME)
public @interface PersistenceAgent
Expresses a dependency on a container-managed
When the annotation occurs on a managed bean class, it assigns a
name to the
EntityAgent
and its associated persistence unit. When this annotation occurs
on a method or field of a managed bean, it declares an injection
point of type EntityAgent.
@PersistenceAgent EntityAgent agent;
EntityAgent in the environment referencing
context java:comp/env of the containing module.
@PersistenceAgent(name = "LibraryAgent")
class Bean
...
EntityAgent agent =
new InitialContext()
.lookup("java:comp/env/LibraryAgent");
...
Every container-managed entity agent is a JTA entity agent.
- Since:
- 4.0
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescription(Optional) The name at which theEntityAgentis accessed in the environment referencing context.(Optional) Properties for the container or persistence provider.(Optional) The name of the persistence unit as defined in thepersistence.xmlfile.
-
Element Details
-
name
String name(Optional) The name at which theEntityAgentis accessed in the environment referencing context. If the specified name does not begin withjava:, then the prefixjava:comp/envis assumed. This member is not usually specified when@PersistenceAgentannotates an injection point.- Default:
""
-
unitName
String unitName(Optional) The name of the persistence unit as defined in thepersistence.xmlfile. This member is optional if there is only one persistence unit defined by the containing module.- Default:
""
-
properties
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.- See Also:
- Default:
{}
-