6.6. Session EJBs as interfaces to entity EJBs

The EJB developer needs to remember this very important principle: Session EJBs (and message-driven EJBs) are pooled on behalf of clients, while entity EJBs are pooled on behalf of the database. The reason we need a pool of entity EJBs is because the application may need to manipulate large database tables (that is, tables with many rows). The container will not normally increase the pool size to support a larger client load.

It is common design practice to use a session EJB as a facade for a number of entity EJBs, with most of the computational logic encapsulated in the session EJB. There are two main reasons for this:

  • to increase concurrency in database access, by reducing the amount of data that ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.