EJB 3.1 specification
This topic describes the EJB 3.1 specification that is the foundation of the development and application programming model for EJB 3.1 applications. Read this topic for a brief overview of the EJB 3.1 specification.
The EJB 3.1 specification focuses on simplification and ease of use. In addition, it adds many new features to the programming model.
- Singleton session beans are a new type of session bean. As the name implies, only one instance of the bean exists. A Singleton is useful for storing data shared by different parts of an application. Data concurrency might be controlled by either the container or the application itself.
- Non-persistent EJB Timers are similar to the persistent EJB Timers that existed before EJB 3.1, except that they exist only in memory and are not stored in a database. Non-persistent timers are useful for scenarios where it is not desirable to retry missed events.
- Automatically created EJB Timers are created automatically when the application starts, and they are removed automatically when the application is uninstalled. Automatically created timers might be either persistent or non-persistent. Automatically created timers are useful because they remove the need for the application or an administrator to explicitly create and remove the timers.
- Calendar based timer expressions allow developers to specify a timeout schedule using a calendar-based syntax that closely resembles the UNIX Cron functionality. Calendar-based expressions are useful because they make it much easier to specify and understand the timeout schedule for a timer.
- Asynchronous method invocation allows applications to run multiple chunks of work in parallel. Asynchronous methods are useful from a performance perspective because work loads are not single threaded, and they are also useful from a simplification perspective because the application programmer is shielded from the complexities associated with multithreaded programming.
- The No-Interface Local View further simplifies the plain old Java objects (POJO) programming model. With the No-Interface Local View, EJBs are no longer required to have a bean interface.
- The embeddable EJB container allows developers to unit test their EJB function in a Java SE environment. The embeddable EJB container is useful because it allows developers to test EJB function quickly and easily in their personal sandbox environment, and it removes the need to install the EJBs into an application server.
- Packaging EJB content in WAR modules allows both web and EJB content to be physically combined into the same module. This packaging option is useful because it might simplify the assembly and installation of the application, and simplifying the interaction between the web and EJB components that are collocated in the same module.
Related:
EJB content in WAR modules Developing singleton session beans Create timers using the EJB timer service for enterprise beans Configure EJB 3.1 session bean methods to be asynchronous Developing a session bean to have a No-Interface Local view Developing applications using the embeddable EJB container