The container is responsible for loading, activating, and in general maintaining the "life-cycle" of objects it provides. EJB have a fairly complex life-cycle. There are several kinds of EJB:
Session Beans: These may be either stateful or stateless, and are primarily used to encapsulate business logic, carry out tasks on behalf of a client, and act as controllers or managers for other beans.
Entity Beans: Entity beans represent persistent objects or business concepts that exist outside a specific application's lifetime. They are typically stored in a relational database. Entity beans can be developed using bean-managed persistence, which is implemented by the developer, or container-managed persistence, implemented by the container.