Session Beans as a Wrapper for Entity Beans

One of the main advantages of modular software is abstraction. An abstract implementation's components communicate through well-defined interfaces, so that any component could be replaced with an alternate module. Entity beans are not fully abstract: Although they expose remote interfaces to clients, their structure is closely tied to the fields in a particular database.

As we have shown, the Web tier uses an EJB layer to interact with the database. If the Web tier manipulates the entity beans directly, encapsulation could be violated because the database schema is exposed through the entity beans to the Web tier. A better design is to place session beans in front of entity beans. In that case, the ...

Get J2EE™ Applications and BEA™ WebLogic Server™ 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.