Magnolia Jackrabbit OCM Integration
What is it? Jackrabbit OCM is an object/JCR persistence (and query) service. This tools lets you to persist Java objects (POJOs) into a JCR compliant repository - including association, inheritance, polymorphism, composition, and the Java Collections framework. Why do we need POJOs in the first place? Often the Content objects you get when reading data form the repository is not enough: - It seems one cannot store Content objects in the servlet container session for use in multiple request-response cycles (maybe this could be solved with a deeper understanding of JCR sessions).
- In many cases you need additional business logic, e.g. the shopping cart that calculates the grand total, tax, discount, shipping costs on all its cart items.
- Often POJOs offer more comfort, security, flexibility with specific accessor methods etc.
Why don't we simply use Content2Bean? The Content2Bean features in Magnolia do a great job of easy conversion of simple Content objects to beans. However you quickly hit a limit with it. - Content2Bean only does the conversion from a Content object to a bean well.
- It only supports the conversion of a certain node to one specific bean type - if you want to use the same data in different contexts as different bean representation, you are out of luck. It seems though as if OCM would have the same limitation.
- It does not handle data types very intelligently when pushing the values back to the node.
- There is no support for storing the node at a certain parent path or generating node names etc. Again, there is no native support for this in OCM either.
|