You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Em...@finantix.com on 2014/10/08 13:00:48 UTC

Setting identifier in a node

Hi All,

We are using jackrabbit 2.6.4 and I would like to know if it is possible 
to set a predefined identifier for a newly created node.

I read that I can get the identifier through getIdentifier method but I 
don't know how to set it (if it is possible).

Why am I asking this ?
We have an import feature that accepts in input a json of elements and 
saves it in our persistence layer (postgresql). Using eclipselink as an 
ORM
I can use a predefined id for every entity in order to know if it exist or 
not.
I would like to maintain the same approach for records saved in jackrabbit 
persistence layer. An easy way to know if an entity exist or not is by the 
idenfier
but I need to set it in the json and let jackrabbit use it. Is it possible 
to do ?


My thanks,
Emanuele Gesuato

Re: Setting identifier in a node

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

It is possible to set the identifier, but quite hard to get right: you
could use the XML import feature with the identifier.

With Jackrabbit Oak, it's easier: you could use your own property, and
create a unique index on that.

Regards,
Thomas


On 08/10/14 13:00, "Emanuele.Gesuato@finantix.com"
<Em...@finantix.com> wrote:

>Hi All,
>
>We are using jackrabbit 2.6.4 and I would like to know if it is possible
>to set a predefined identifier for a newly created node.
>
>I read that I can get the identifier through getIdentifier method but I
>don't know how to set it (if it is possible).
>
>Why am I asking this ?
>We have an import feature that accepts in input a json of elements and
>saves it in our persistence layer (postgresql). Using eclipselink as an
>ORM
>I can use a predefined id for every entity in order to know if it exist
>or 
>not.
>I would like to maintain the same approach for records saved in
>jackrabbit 
>persistence layer. An easy way to know if an entity exist or not is by
>the 
>idenfier
>but I need to set it in the json and let jackrabbit use it. Is it
>possible 
>to do ?
>
>
>My thanks,
>Emanuele Gesuato