[
https://issues.apache.org/jira/browse/OAK-713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13608980#comment-13608980
]
Marcel Reutegger commented on OAK-713:
--------------------------------------
bq. However, in practice I find the Jackrabbit behavior quite troublesome.
While one may agree with this statement, the specification IMO is quite clear,
which is probably the reason why Jackrabbit behaves as it does right now.
There is a clear distinction between setting a single- vs. a multi-valued
property:
http://www.day.com/specs/jcr/2.0/10_Writing.html#10.4.2.6%20Setting%20Multi-value%20vs.%20Single-value%20Properties
I'd rather say it is unexpected to get a multi-valued property when I use the
single-valued version of setProperty().
In addition the spec also talks about selecting the property definition:
http://www.day.com/specs/jcr/2.0/10_Writing.html#10.5%20Selecting%20the%20Applicable%20Item%20Definition
IMO it is quite clear the repository should (first) look only at the matching
definitions no matter if it is a named or residual definition. Converting the
value if there is no matching definition, might be OK in a second step.
bq. Taken to the extreme it would allow a jcr:primaryType property of an
nt:unstructured node to be a multi-valued binary property.
Right, according to the spec this is allowed in theory, though in practice it's
not possible because jcr:primaryType is set already when you add a node. It's
actually up to the implementation to decide what would happen if it was
possible in practice:
bq. "If more than one item definition still applies even after taking the name
and type constraints into consideration, the repository may either fail the add
attempt or automatically select one of the item definitions based on
implementation-specific criteria."
> Automatic property type conversion
> ----------------------------------
>
> Key: OAK-713
> URL: https://issues.apache.org/jira/browse/OAK-713
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: core, jcr
> Reporter: Jukka Zitting
> Assignee: Jukka Zitting
> Priority: Minor
>
> It would be nice if, instead of throwing a validation error, Oak could
> automatically do basic property type conversions that lose no content. For
> example a single value could automatically be transformed to a multi-valued
> property when required by the matching property definition.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira