Stateless session beans for stateless services. Looks like a stateful session bean. Lifecycle from client point of view, no need for explicit discarding of the state. Lifecycle from container point of view, no need for activation and passivation.
// Business interface dependency injection // Instance per session @EJB Cart cart; // Business interface naming service lookup // Instance per session @Resource SessionContext ctx; Cart cart = (Cart) ctx.lookup (“cart”); // Home interface dependency injection // Instance created explicitly @EJB CartHome cartHome; Cart cart = cartHome.createLargeCart (...); // Home interface naming service lookup // Instance created explicitly @Resource SessionContext ctx; CartHome cartHome = (CartHome) ctx.lookup (“cartHome”); Cart cart = cartHome.createLargeCart (...);