Annotations were introduced in Java 5.0. The purpose of having annotations is to attach additional information in the class or a meta-data of a class within its source code. In EJB 3.0, annotations are used to describe configuration meta-data in EJB classes. By this way, EJB 3.0 eliminates the need to describe configuration data in configuration XML files.
EJB container uses compiler tool to generate required artifacts like interfaces, deployment descriptors by reading those annotations. Following is the list of commonly used annotations.
Sr.no | Name | Description |
---|---|---|
1 |
javax.ejb.Stateless
|
Specifies that a given EJB class is a stateless session bean.
Attributes
|
2 |
javax.ejb.Stateful
|
Specifies that a given EJB class is a stateful session bean.
Attributes
|
3 |
javax.ejb.MessageDrivenBean
|
Specifies that a given EJB class is a message driven bean.
Attributes
|
4 |
javax.ejb.EJB
|
Used to specify or inject a dependency as EJB instance into another EJB.
Attributes
|
5 |
javax.ejb.Local
|
Used to specify Local interface(s) of a session bean. This local interface states the business methods of the session bean (which can be stateless or stateful).
This interface is used to expose the business methods to local clients, which are running in the same deployment/application as EJB.
Attributes
|
6 |
javax.ejb.Remote
|
Used to specify Remote interface(s) of a session bean. This remote interface states the business methods of the session bean (which can be stateless or stateful).
This interface is used to expose the business methods to remote clients, which are running in different deployment/application as EJB.
Attributes
|
7 |
javax.ejb.Activation ConfigProperty
|
Used to specify properties required for a message driven bean. For example, end point, destination, message selector etc.
This annotation is passed as a parameter to activationConfig attribute of javax.ejb.MessageDrivenBean annotation.
Attributes
|
8 |
javax.ejb.PostActivate
|
Used to specify callback method of EJB lifecycle. This method will be called when EJB container just activated/reactivated the bean instance.
This interface is used to expose the business methods to local clients, which are running in same deployment/application as EJB.
|
No comments:
Post a Comment