12.2.3 Implementing the Enterprise Beans when an annotation is specified
(1) Implementing Stateless Session Bean
- Specify the type of Enterprise Bean (Stateless Session Bean) either in the @Stateless annotation or in the DD (ejb-jar.xml).
- You can implement Session Bean by using a business interface.
- Implementing the javax.ejb.SessionBean interface is not mandatory.
- Implement an interceptor class as and when required.
- You can define the following callbacks in the Stateless Session Bean:
- @PostConstruct
- @PreDestroy
For details on callback or the method invocation time, see 2.2.3 Life cycle of Enterprise Beans in the uCosminexus Application Server EJB Container Functionality Guide.
(2) Implementing Stateful Session Bean
- Specify the type of Enterprise Bean (Stateful Session Bean) either in the @Stateful annotation or in the DD (ejb-jar.xml).
- You can implement Session Bean by using a business interface.
- Implementing the javax.ejb.SessionBean interface and the java.io.Serializable interface is not mandatory.
- Implement an interceptor class as and when required.
- You can define the following callbacks:
- @PostConstruct
- @PreDestroy
- You can specify the @Init annotation and @Remove annotation in the methods of the implementation class.
For details on callback or the method invocation time, see 2.2.3 Life cycle of Enterprise Beans in the uCosminexus Application Server EJB Container Functionality Guide.