You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by Christophe Lombart <ch...@gmail.com> on 2006/03/14 09:03:05 UTC
JCR Inheritance mapping : NodeType per hierarchy
Alex,
I'm building some unit tests for the inheritance mapping strategies.
For the Node Type per hierarchy, I would like to check with you the
following points. Let me know if you are not agree.
1/ if the path field is defined in the ancestor class, it is not
necessary to redefine it in the descendants.
2/ It is possible to use an ancestor class to retrieve an object - Eg. :
We have an ancestor class CmsObject and 2 descendant classes :
Folder and Content. than we can do :
CmsObject object = (CmsObject)
persistenceManager.getObject(CmsObject.class,"/folder1");
the node "/folder1" is associated to the class Folder, than the
variable "object" point to a object based on the Folder class. Of
course, the getObject will never returns an object build with the
Ancestor class.
Of course, it is also possible to do :
Folder object = (Folder) persistenceManager.getObject(Folder.class,"/folder1");
Same behaviour for collection retrieve. It is possible to make queries like :
"Get a collection of CmsObject which the title contains "JCR". The
collection items are either build with Folder or Content class (and of
course never with CmsObject).
--
Best regards,
Christophe
Re: JCR Inheritance mapping : NodeType per hierarchy
Posted by Alexandru Popescu <th...@gmail.com>.
Hi Chris!
I will get back to you later today. Sorry, but I was offline these days.
./alex
--
.w( the_mindstorm )p.
#: Christophe Lombart changed the world a bit at a time by saying (astral date: 3/14/2006 11:03 AM) :#
> Alex,
>
> I'm building some unit tests for the inheritance mapping strategies.
> For the Node Type per hierarchy, I would like to check with you the
> following points. Let me know if you are not agree.
>
> 1/ if the path field is defined in the ancestor class, it is not
> necessary to redefine it in the descendants.
>
> 2/ It is possible to use an ancestor class to retrieve an object - Eg. :
> We have an ancestor class CmsObject and 2 descendant classes :
> Folder and Content. than we can do :
>
> CmsObject object = (CmsObject)
> persistenceManager.getObject(CmsObject.class,"/folder1");
>
> the node "/folder1" is associated to the class Folder, than the
> variable "object" point to a object based on the Folder class. Of
> course, the getObject will never returns an object build with the
> Ancestor class.
>
> Of course, it is also possible to do :
> Folder object = (Folder) persistenceManager.getObject(Folder.class,"/folder1");
>
>
> Same behaviour for collection retrieve. It is possible to make queries like :
> "Get a collection of CmsObject which the title contains "JCR". The
> collection items are either build with Folder or Content class (and of
> course never with CmsObject).
>
> --
> Best regards,
>
> Christophe
>