Description: EJBs are the de facto standard when it comes to server-side components developed in J2EE. Session beans are used for business logic components and are primarily of two types: Stateful and Stateless. The type of the bean, stateful or stateless, is decided at deployment time through some deployment parameters. There are many scenarios where the decision of needing a stateful bean can be deferred until runtime. This article explains a pattern that can be used to dynamically choose a stateful bean at runtime.