Mapping Collection Fields
The collection-descriptor maps a collection attribute into JCR nodes or in a multivalue property.
Based on our model defined here, the following collection-descriptor is used to map the "paragraphs" field into the JCR node called "paragraphs".
The collection-descriptor contains the elementClassName attribute which specify the collection element class. A class descriptor for the element class has also to be defined.
Following our example, the resulting JCR structure is:
By default, the persistence manager will create a subnode (/mysite/page1/paragraphs). This one will contains the different paragraphs.
As explained in the following sections, it is possible to map to another JCR structure. It is also possible to use another name for the jcr node names (see above).
The OCM framework is supporting the following java types:
- Collections Collection, List, Set, ArrayList, Vector, HashSet
- Maps Map, HashMap
It is possible to support other Collection or Map types with the ManageableCollection interface.