jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "panos.athanasiou" <panos.athanas...@gmail.com>
Subject Re: Weird behaviour with child type resolution
Date Tue, 10 Nov 2009 10:38:05 GMT

The XML describing the mentioned types is as following:

<nodeType hasOrderableChildNodes="true" isMixin="false"
name="myNameSpace:BaseEntity"
		primaryItemName="">
		<supertypes>
			<supertype>mix:referenceable</supertype>
			<supertype>nt:base</supertype>
		</supertypes>
		<propertyDefinition autoCreated="false" mandatory="false"
			multiple="false" name="myNameSpace:creationDate" onParentVersion="IGNORE"
			protected="false" requiredType="Date" />
</nodeType>

<nodeType hasOrderableChildNodes="true" isMixin="false"
		name="myNameSpace:YetAnotherEntity" primaryItemName="">
		<supertypes>
			<supertype>myNameSpace:BaseEntity</supertype>
		</supertypes>
</nodeType>



<nodeType hasOrderableChildNodes="true" isMixin="false"
name="myNameSpace:AnotherEntity" primaryItemName="">
               <supertypes>
			<supertype>myNameSpace:BaseEntity</supertype>
		</supertypes>
	 	<childNodeDefinition autoCreated="false"
			defaultPrimaryType="" mandatory="false" name="myNameSpace:BaseEntity"
			onParentVersion="IGNORE" protected="false" sameNameSiblings="true">
		<requiredPrimaryTypes>
			<requiredPrimaryType>myNameSpace:BaseEntity</requiredPrimaryType>
		</requiredPrimaryTypes>
	</childNodeDefinition>
</nodeType>


I am using version 1.5.5 . 

The actual code for creation looks like this:

Node aNode = nodeOfTypeAnotherEntity.addNode("myNameSpace:YetAnotherEntity",
"myNameSpace:YetAnotherEntity");


As it has come to my understanding, EffectiveNodeType.getNamedItemDefs()
returns only Item definitions for types directly mentioned in the
definition. Thus, given that EffectiveNodeType.getApplicableChildNodeDef()
works on the given type (in my case, this is "myNameSpace:YetAnotherEntity")
but not it's supertypes,  it seems normal that the type resolution does not
happen as i expected. At least, that much i gathered while trying out
different things with the debugger.






Alexander Klimetschek wrote:
> 
> On Tue, Nov 10, 2009 at 10:49, panos.athanasiou
> <panos.athanasiou@gmail.com> wrote:
>> Thus, i created the following entities:
>>
>> myNameSpace:BaseEntity
>>
>> myNameSpace:AnotherEntity with children of type BaseEntity
>>
>> myNameSpace:YetAnotherEntity having as supertype BaseEntity.
>>
>>
>> Then, i created an instance of myNameSpace:AnotherEntity and tried to add
>> to
>> it a Node of type myNameSpace:YetAnotherEntity. To my surprise though, i
>> received an exception like the following:
>>
>> javax.jcr.nodetype.ConstraintViolationException: no definition found in
>> parent node's node type for new node: no matching child node definition
>> found for {http://myNameSpace.org/}YetAnotherEntity : no matching child
>> node
>> definition found for {http://myNameSpace.org/}YetAnotherEntity
>>        at
>> org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:768)
>>        at
>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:734)
>>        at
>> org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:682)
>>        at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2115)
>>
>> Any ideas/suggestions?
> 
> It should work. Could you post your node type definitions (cnd, xml,
> whatever you used)?
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://n4.nabble.com/Weird-behaviour-with-child-type-resolution-tp585307p585325.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message