0

I'm fairly new to the JCR space and have inherited a project using Jackrabbit/Apache Oak as the JCR implementation.

I have a data model which I'm trying to translate into a JCR node structure like below:

{
    "someProperty": [
        [ "some-property-1", "some-property-2" ],
        [ "some-property-3", "some-property-4" ]
    ]
}

Is this possible?

The reason I ask, is that it seems like all methods for adding nodes on the javax.jcr.Node type take a name.

For instance:

addNode(String relPath)

I'm guessing it'd be best to model out the subarrays (e.g. [ "some-property-1", "some-property-2" ]) as their own nodes, but not sure if this is possible with the facilities at hand.

Please excuse any ignorance of JCR!

In an ideal world, I'd do something like:

parentNode.addNode("someProperty")
    .addNode().setProperty(["some-property-1", "some-property-2"])
    .addNode().setProperty(["some-property-3", "some-property-4"])
carbon_ghost
  • 1,114
  • 5
  • 18
  • 40

1 Answers1

0

No, there is no nesting like that in JCR.

You could:

  • transform these into nestable nodes, or
  • overload the property name, or
  • just use string values, and parse/serialize yourself...
Julian Reschke
  • 40,156
  • 8
  • 95
  • 98