Data model implementation and patterns used across the CDM

It is worth touching on a couple of common patterns used in implementing the CDM in java: private no-arg constructors andprotected access to collection setters. The ORM technology used in the CDM requires that no-arg constructors exist, and likewise it requires that collections have setter methods as well as getters. However, it is good practice to prevent client application access to these methods to prevent application developers inadvertantly causing mischief (for example, by incorrectly implementing a bidirectional link between a parent and child object).

To instantiate a new CDM entity programmatically, application developers must use one of the public static factory methods provided by the class. Changing the state of single properties is achieved through normal use of getters and setters. In the case of properties that extend java.util.Collection or java.util.Map, these collections can be changed through addX and removeX, where X is the property name rather than setX.