Hi there,
We have the following in a nodetype definition:
<propertyDefinition name="foobar" requiredType="WeakReference"
autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
multiple="false" isFullTextSearchable="false" isQueryOrderable="false"/>
.. and the following code …
nodeA.setProperty("foobar", nodeB);
The Javadoc of javax.jcr.Node#setProperty(String name, Node value) says:
[…]
* If the named property does not yet exist and the repository cannot
* determine whether a <code>REFERENCE</code> or <code>WEAKREFERENCE</code>
* property is intended, then a <code>REFERENCE</code> property is created.
[…]
… so we assumed that the NT def would drive this decision.
But when exporting nodeA, we see that the property was created as a (hard)
Reference. Looking at the code of
org.apache.jackrabbit.commons.AbstractNode#setProperty(String name, Node
value), it looks like it's not trying at all to make any sort of informed
decision, and just delegates to javax.jcr.ValueFactory#createValue(Node value)
which is explicitly spec'd to create (hard) Reference properties.
Is this supposed to be this way ? Is this an implementation bug, a
documentation bug, or just something that I'm overseeing (which is far from
unlikely) ?
Thanks for any hint !
Cheers,
-greg