Extending Business Entities

Business entities are the Java representation of persistent data in the system. These objects are transparently initialized and persisted into the database. Many entities are already defined by the base application but may be extended through customization. Likewise, new entities may be created which expose custom tables as business entities.

There are two kinds of hand-coded logic associated with business entities: logic that exposes useful methods to the outside world and logic that is used within the entity itself to perform validation and handle the cascading effects of its changes in state.

Logic exposed to outside callers is what is coded on the business entity's implementation class (the "Impl") class. These "business methods" are then generated onto the entity's "business interface" (e.g. the Person interface). The business interface is the contract that the entity has with other objects.

Quite another thing is how an entity validates and otherwise deals with its changes of state. This is event-driven logic that is not exposed to outside callers and never belongs on the business interface. This type of interface is commonly referred as a "specialization interface" rather than a "business interface" and is coded in change handlers. Unlike a business interface, which receives messages from other objects, a specialization interface is one that provides a mechanism purely for extension of some baseline behavior. In that spirit, the framework design clearly separates the two kinds of code.