EJB Development Steps

 

Implement EJB Interface Interfaces required by standard EJB component model to enable container-based management of EJB

Implement EJB Business-Specific Class

(bean class)

Any business-specific interfaces (usually in session beans) and any supporting helper and utility classes.
Compile EJB Code Compile: EJB classes
Deployment Descriptors

create for deployment of your EJBs (optional if using annotations)

specifies:

EJB type,
transaction attributes,
security attributes.

Package EJBs into EJB Jar module* Optional but, a good idea.
Application Deployment Descriptor Optional, but, if grouped into modules will need
Deploy the Aplication Deploy to container using descriptor(s).

 

Client Code Development

1. Grab EJB object to execute business logic on

(e.g. JNDI service for Remote EJB)

See http://puzzle.mcs.csueastbay.edu/docs/javaee-tutorial/doc/gipjf.html#gipiz for different combinations - local or remote client using dependency injection or JNDI

OPTION 1: Using JNDI for remote EJB

 

OPTION 2: Local and no interface EJB using dependency injection

For @Local declared EJB bean class (no interface class needed), can use dependency injection to get an instance of Bean and used its methods directly

 

@EJB  ExampleBean exampleBean;

exampleBean.businessMethod1();

 

 

2. Invoke methods on EJB object (here called A)

A.addCourse(); //what ever method you want.