The Persistence Manager
The main component in our framework is the Persistence manager. It converts an object graph into JCR nodes and properties and vice versa.
How the Persistence Manager is working ?
Thanks to a mapping descriptor file, the Persistence Manager can use the more appropriate mapping strategy for each objects.
The descriptor file contains one class descriptor for each mapped class. Each class descriptor contains mapping information for the corresponding class attributes. The descriptor file contains also information on object associations, inheritance mapping strategy, lazy loading, cache strategy, ...
There are 4 attributes/fields "types" :
- Simple fields : primitive data types and simple objects (String, Long, Double, ...) . Thoses fields are mapped into JCR properties.
- Bean fields : One class can contain an 1..1 association to another bean. In this case, the attribute is a custom object. Those fields are mapped into JCR nodes.
- Collection fields : One class can contain an 1..n association to a collection of beans (or Map). Those fields are mapped into a collection of JCR nodes.
- Reference field : One good example to understand the "reference" type is the Folder concept. A folder "B" can have an attribute called "parentFolder" which is a simple field pointing to the parent folder "A" . Of course, in a JCR repository, it is a nonsense for persist this "parentFolder" attribute into a "B" subnode. Another interesting example are links made between cms objects (folders, documents, ...).
Of course, all those "mapping types" imply different mapping algorithms.See the "Mapping Strategies" section to get more information on the descriptor file.