Part IV. Container Services

While server-side component types handle business logic and entities address state, the EJB Container can continue to make our jobs easier by providing a wide range of generic and configurable services. Enterprise applications generally handle a large number of concurrent users, and each request might need to be handled carefully so it does not violate the security or integrity of the application. Additionally, we shouldn’t waste our time wiring our modules together; the container can do this for us. Perhaps we have some other cross-cutting concern we’d like to model and apply on our own. For these requirements, EJB offers a range of container services.

Security (Chapter 15) addresses the need to authorize and authenticate users uniformly across the application. Not all requests should be given carte blanche access to the whole application, and this is EJB’s mechanism to declaratively or programmatically restrict access.

Injection (Chapter 16) allows our modules to communicate with one another without the explicit need to perform service lookups. We can also use injection to define dependency relationships between resources.

Transactions (Chapter 17) ensure that our application’s state maintains its integrity while under load from concurrent use. Although traditionally this is a very difficult paradigm to achieve manually, EJB provides us with a declarative syntax to guard our business logic methods and, by extension, associated resources such as the EntityManager ...

Get Enterprise JavaBeans 3.1, 6th Edition 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.