On Mon, Apr 4, 2011 at 2:42 PM, Stefan Guggisberg <[email protected]> wrote: > On Mon, Apr 4, 2011 at 2:18 PM, Markus Joschko <[email protected]> > wrote: >> On Mon, Apr 4, 2011 at 1:56 PM, Stefan Guggisberg >> <[email protected]> wrote: >>> On Mon, Apr 4, 2011 at 1:13 PM, Markus Joschko <[email protected]> >>> wrote: >>>> Hi, >>>> I have a node that should mix free and and fixed properties. >>>> For that purpose I created the following nodetype (leaving out the >>>> namespace): >>>> >>>> [Contact] > nt:unstructured, mix:created, mix:lastModified >>>> - primaryContactDetails (weakreference) >>>> >>>> [Individual] > Contact >>>> >>>> >>>> When I create a node of type Individual and set the >>>> primaryContactDetails property to another referencable node, it gets >>>> the typ "reference". >>>> Asked for its required type the property returns "undefined" and as >>>> the DeclaringNodeType it returns "nt:unstructured". >>>> >>>> When I remove "nt:unstructured" from the inheritance list, I get the >>>> desired "weakreference" and Contact as DeclaringNodeType. >>>> >>>> Obviously "nt:unstructure" takes precedence over the defined >>>> properties. >>> >>> no, named definitions should take precedence over residual definitions. >>> weak reference were introduced in jsr-283 (jcr 2.0). you probably >>> encountered a problem that is specific to weakreferences. >> >> I did some more tests: >> 1) when using a defined name with the defined type -> the correct >> nodetype is used >> 2) when using a residual name -> nt:unstructured is taken as declaring >> nodetype > > what do you mean by 'residual name'? could you please provide > an example for better understanding? > >> 3) when using a defined name but a type that is incompatible with the >> defintion -> nt:unstructured is used as declaring nodetype >> >> Is 3) really a valid behaviour? > > yes > >> I would expect this to fail. > > there's a matching residual definition, why should it fail?
Because I gave more detailed instructions for a property with that name. Isn't the property name somewhat the key/id of a property or is it property name + property type? When the name is the id I would have expected jcr to check against the definition, notice that the more specific defintion of the property does not match the input and throw an error. Otherwise nt:unstructured is kind of dangerous as it silently swallows everything thrown at it. I learned my lesson, that I have to be very specific with the type in combination with nt:unstructured, but I don't find it very intuitive. > >> That's not only for weakreferences but for all types I tested. It is >> especially easy to notice with weakreferences as >> I can only pass a node to the setProperty method and must rely on >> jackrabbit to set the correct type. > > i can't follow you here. you can use either [1] or [2]. > > [1] > http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#setProperty(java.lang.String, > javax.jcr.Value) > [2] > http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#setProperty(java.lang.String, > java.lang.String, int) I have completely missed that. That'll work fine. > cheers > stefan > >> >>> do you mind filing a jira issue? a simple test case would be great :) >> >>> >>> cheers >>> stefan >>> >>>> Is there an other way to combine defined and undefined >>>> properties in a node? >>>> >>>> I currently use jackrabbit 2.1.1 >>>> >>>> >>>> Regards, >>>> Markus >>>> >>> >> >
