Creating an entity facade

A building facade is a false front to a building. Movie sets frequently use facades to give the appearance of an actual building avoiding the cost of a real building. In programming, a facade is an object which provides an interface to another class to make the hidden class easier to use or reduce dependencies among classes.

Getting ready

We will build upon the EntityBeanApplication application from the previous recipe. We will be adding to the EJB module two new classes to the packt package: AbstractFacade and PartsBeanFacade.

An entity facade is commonly used to hide the entity class. A typical approach is to create a base class encapsulating much of the common functionality of an entity and then extend this class with ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.