Skip to content

Latest commit

 

History

History
24 lines (13 loc) · 1.2 KB

File metadata and controls

24 lines (13 loc) · 1.2 KB

Events in Jakarta EE

Observer methods in EJB session beans

An observer method may also be a non-abstract method of an EJB session bean class. It must be either a business method exposed by a local business interface of the EJB or a static method of the bean class.

Declaring an observer method in an EJB

If a non-static method of a session bean class has a parameter annotated @Observes or @ObservesAsync, and the method is not a business method exposed by a local business interface of the EJB, the container automatically detects the problem and treats it as a definition error.

Observer method invocation context in Jakarta EE

When running in Jakarta EE, the container must extend the rules defined in [observer_method_invocation_context] and must also ensure that all kinds of observers are called in the same client security context as the invocation of Event.fire() or Event.fireAsync().

The transaction and security contexts for a business method exposed by a local business interface of an EJB session bean also depend upon the transaction attribute and @RunAs descriptor, if any.