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 Costin Leau <co...@gmail.com> on 2005/10/10 17:27:15 UTC

Re[2]: [jcr-mapping] Mapping Node.getPath() to domain objects


> for describing unique identifier we can have something like that:
> <path fieldName="path">
> </path>
I would differ - the path can also be viewed as being a different
table. The path is not part of the object content so it shouldn't be
treated as one.
The database impose the object to have an id - a special field. Note
that it doesn't have to be a unique id over the database - smth that
would happen if the path is considered as part of the object.
The most approapriate method would be to require and id from the user
which can be generated or supplied by him/her.
This way the developer can chose if she/he wants a long/int or a
String UUID. Creating syntetic attributes based on an object will fail
eventually (for example if I move the path the object identity changes
- in the database world if I rename an object the identity is the
same).

-- 
Best regards,
 Costin                            mailto:costin.leau@gmail.com


Re: Re[2]: [jcr-mapping] Mapping Node.getPath() to domain objects

Posted by Christophe Lombart <ch...@gmail.com>.
On 10/10/05, Costin Leau <co...@gmail.com> wrote:
>
>
>
> > for describing unique identifier we can have something like that:
> > <path fieldName="path">
> > </path>
> I would differ - the path can also be viewed as being a different
> table. The path is not part of the object content so it shouldn't be
> treated as one.
> The database impose the object to have an id - a special field. Note
> that it doesn't have to be a unique id over the database - smth that
> would happen if the path is considered as part of the object.
> The most approapriate method would be to require and id from the user
> which can be generated or supplied by him/her.
> This way the developer can chose if she/he wants a long/int or a
> String UUID. Creating syntetic attributes based on an object will fail
> eventually (for example if I move the path the object identity changes
> - in the database world if I rename an object the identity is the
>
same).


In summary, we have 3 possibilities :

<class-descriptor
className="org.apache.portals.graffito.jcr.testmodel.Atomic"
jcrNodeType="nt:unstructured">
<field-descriptor fieldName="myId" jcrName="myId" id = 'true'/>
.... other field, beans and collection descriptor ...
</class-descriptor>


<class-descriptor
className="org.apache.portals.graffito.jcr.testmodel.Atomic"
jcrNodeType="nt:unstructured">
<field-descriptor fieldName="myId" jcrName="UUID" id = 'true'/>
.... other field, beans and collection descriptor ...
</class-descriptor>


<class-descriptor
className="org.apache.portals.graffito.jcr.testmodel.Atomic"
jcrNodeType="nt:unstructured">
<field-descriptor fieldName="myId" jcrName="PATH" id = 'true'
sameNameSibling="false" />
.... other field, beans and collection descriptor ...
</class-descriptor>


Is the first one is still insteresting ? because we can replace it by UUID.