jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Weird behaviour with child type resolution
Date Tue, 10 Nov 2009 10:53:11 GMT
On Tue, Nov 10, 2009 at 11:38, panos.athanasiou
<panos.athanasiou@gmail.com> wrote:
> <nodeType hasOrderableChildNodes="true" isMixin="false"
> name="myNameSpace:AnotherEntity" primaryItemName="">
>               <supertypes>
>                        <supertype>myNameSpace:BaseEntity</supertype>
>                </supertypes>
>                <childNodeDefinition autoCreated="false"
>                        defaultPrimaryType="" mandatory="false"
>
> name="myNameSpace:BaseEntity"

This means that this child node definition only allows child nodes
named "myNameSpace:BaseEntity"...

>                        onParentVersion="IGNORE" protected="false" sameNameSiblings="true">
>                <requiredPrimaryTypes>
>                        <requiredPrimaryType>myNameSpace:BaseEntity</requiredPrimaryType>
>                </requiredPrimaryTypes>
>        </childNodeDefinition>
> </nodeType>
>
>
> The actual code for creation looks like this:
>
> Node aNode = nodeOfTypeAnotherEntity.addNode("myNameSpace:YetAnotherEntity",
> "myNameSpace:YetAnotherEntity");

.. but here you are using "myNameSpace:YetAnotherEntity" (first param)
as node name. Thus it fails.

You should change the name of the child node definition (you can use
"*" to allow any node name) or the name used in the addNode() call.

See also http://jackrabbit.apache.org/node-type-notation.html#NodeTypeNotation-NodeName

BTW, I would recommend not to use the same names for node types and
node names, and only use namespaces in node names/property names if
they should really be distinctive. Otherwise using plain names is much
more readable and forces more standardization of names in and between
your applications.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message