Business and Integration Tiers Bad Practices J2EE

Problem Summary

One of the common practices in designing an EJB application is to map the object model directly into entity beans; that is, each class in the object model is transformed into an entity bean. This results in a large number of fine-grained entity beans.

The container and network overhead increases as the number of enterprise beans increases. Such mapping also transforms object relationships into entity-bean-to-entity-bean relationships. This is best avoided, since entity-bean-to-entity-bean relationships introduce severe performance implications.

Solution Reference

Identify the parent-dependent object relationships in the object model and design them as coarse-grained entity beans. This results in fewer entity beans, where each entity bean composes a group of related objects from the object model.

Solution Reference

Consolidate related workflow operations into session beans to provide a uniform coarse-grained service access layer.

Solution Reference

Using Entity Beans as Fine-Grained ObjectsProblem Summary

Entity beans are meant to represent coarse-grained transactional persistent business components. Using an entity bean to represent fine-grained objects increases the overall network communication and container overhead. This impacts application performance and scalability.

A fine-grained object is best thought of as an object that has little meaning without its association to another object (typically a coarse-grained parent object). For example, an item object can be thought of as a fined-grained object because it has little value until it is associated with an order object. In this example, the order object is the coarse-grained object and the item object is the fine-grained (dependent) object.

Solution Reference

When designing enterprise beans based on a preexisting RDBMS schema,

Solution Reference

When designing enterprise beans using an object model,

Design coarse-grained entity beans and session beans. Apply the following patterns and refactorings that promote coarse-grained enterprise beans design.

Solution Reference

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

J2EE Topics