The combined entity pattern is used for the EJB persistence mechanism. A composite entity is an EJB entity bean that represents an object graph. When a composite entity is updated, the internal dependency object Bean is automatically updated to be managed by the EJB entity Bean. The following are the participants in the composite entity bean.
-
Composite Entities -it is the primary entity bean. It can be coarse-grained or can contain coarse-grained objects for persistence purposes.
-
coarse-Grained object -This object contains dependent objects. It has its own life cycle and manages the life cycle of the dependent objects.
-
Dependent object -a dependent object is an object, depending on its persistent life-cycle coarse-grained object.
-
Policy -policy represents how to implement complex composite entities.
Implementing an instance
In the example of this implementation, the object is created CompositeEntity as a CompositeEntity . CoarseGrainedObjectis a class that contains dependent objects. CompositeEntityPatternDemois a demo class that uses Client classes to demonstrate the use of composite entity patterns.
The structure of the composite entity pattern example is as shown in-
Click on the link to view the details
Java Composite entity Mode ~