On 16 Nov 2009, at 6:38:34 AM, Alexander Klimetschek wrote:
> 2009/11/16 Fabián Mandelbaum <fmandelbaum@gmail.com>:
>> It's simpler than fiddling around with this low-level stuff actually:
>>
>> Just create a DAO to abstract all JCR operations (as you should be
>> doing already)
>
> (To give my usual opinion about object content mapping and JCR:) If
> you use DAOs this of course is a straight-forward solution (but only
> for the code that uses the DAO layer), but I think that using JCR
> directly is not "low-level" stuff:
>
> - JCR Node already is like a DAO, and a more flexible one (nt:unstructured)
> - nodetypes can give you validation
> - session (+ transactions) provide all you need for managing the
> object's lifetime and separation into sessions
> - access control, versioning, search etc. are quite high-level IMO, so
> you should use them directly
>
> I see the point for DAOs only when you really want to be sure that
> application coders can only use the properties you designed for them.
> Or when you have a relational model and are required to map it onto an
> object model, but that's not the case with JCR. An OCM only adds an
> additional layer of code and complexity.
>
> Just my 2 cents...
> Alex
I think there is a confusion when using the term DAO. It can mean Data Access Object or Data(base)
Abstraction Object (better termed repository). I believe the OP was using it in the second
sense, which just means do not directly use session.save, but use dao.save( node ) instead.
Rakesh
Rakesh