Design Patterns Composite Entity Pattern - Design Patterns

What is Design Patterns Composite Entity Pattern?

Composite Entity pattern is use in EJB persistence mechanism. A Composite entity is an EJB entity bean which represents a diagram of objects.

When a composite entity is updated, inside dependent objects beans get updated automatically as being manage by EJB entity bean. Following are the participants in Composite Entity Bean.

  • Composite Entity - It is primary entity bean. It can be coarse grained or can contain a coarse grained object to be used for persistence purpose.
  • Coarse-Grained Object - This object contains dependent objects. It has its own life cycle and also manages life cycle of dependent objects.
  • Dependent Object - Dependent object is an object which depends on coarse grained object for its persistence lifecycle.
  • Strategies - Strategies represents how to implement a Composite Entity.


We are going to make Composite Entity object acting as Composite Entity. CoarseGrainedObject will be a class which contains dependent objects. CompositeEntityPatternDemo, our demo class will use customer class to show use of Composite Entity pattern.


Step 1

Construct dependent relative Objects.

Step 2

Create Coarse Grained Object.

Step 3

Create Composite Entity.

Step 4

Create Client class to use Composite Entity.

Step 5

Make use of the Client to demonstrate Composite Entity design pattern usage.

Step 6

Verify the output.

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

Design Patterns Topics