Monday 28 January 2008 13:07:25 Christophe Lombart написав: > > There is also the annotation support in Jackrabbit OCM. > ... but ok the doc is missing :-) > Well, what if good OCM in my humble opinion? Yes, documented with examples! :)
0. It must work recursive because we work with tree. 1. It does not demand a lot of efforts or takes no time for writing mappings. No long XMLs. Annotations just OK, my be even annotations that available at run-time. Developer just registers classes with required annotations and system knows how to work with them. 2. OCM must check class and class versions while loading of saving nodes. What to do if something goes wrong? I decided to take "best effort" strategy. We map what we can and leave data untouched if in doubt. and yes, we strictly warn developer and admin. 3. OCM must have possibility to find typed objects by parameters and by types. 4. OCM must have transactional manager just like in JPA or EJB 3.0 5. JCR path shoud never be mapping parameter. This is runtime parameter because one can retrive same data types from different places. 6. My strategy for light OCM is: class is typed node, simple class field is property, class instance field is subnode and so on recursively. And yes, I just ignore JCR node type mechanics because it is too inconvinient. A couple of words about recursion. There are 2 different apects. First, you may have class that contains link to itself. It is very convinient for things like categories and so on. But this is infinite recursion and I use "deep" property to make it finite. Second, when class has properties as class instance that has properties as class instance etc... We must go down to simple types and make nodes for all of it. May be good solution id annotation inheritance for this case. If some property marked as persistent so all stuff that containde in property myst be marked as persistent. And few words about content modeling. Some guys like to write XML for data modeling, it's OK but not good because you can not model things like <mynewsdir><$year><$month>... There's no defines of vars and no possibility for dynamic tress. That's why my JAXB based solution not good for OCM. May be OCM annotated classes will be better and more clean for data modeling? And finally. I do not see any advantages of JCR comparing to traditional database without good and ease to use OCM and content modeling tools. My expirience says: JCR is just more time for development without any significant pluses. Hope, my comments will be helpfull for users and develoipers. -- SY, Alex Lukin RIPE NIC HDL: LEXA1-RIPE
