Objective 4.4: Recognize appropriate uses for Entity, Stateful Session, and Stateless Session beans

Session Beans

Session Beans are suitable when:

  • The state of the bean is not persistent
  • To implement business logic or workflow
  • To mediate between the client and other components (façade)

Stateful Session Beans are appropriate when:

  • The bean must manage conversational state across method invocations

Stateless Session Beans are appropriate when:

  • There is no need for conversational state. Stateless session beans are often used as façades to other components

Entity Beans

Entity Beans are suitable when:

  • The bean represents a business entity, not a flow
  • The bean’s state must be persistent beyond that of the application server.

Stateful Session Bean
  • shopping cart
Stateless Session Bean
  • credit card authorization
  • session façade
Entity Bean
  • Order
  • Account
  • Customer

Useful links

Stuff to read

Wish me luck