jcrjackrabbitdmsjcr-sql2

Unique identifier for documents stored in Jackrabbit


I m fairly new to Apache Jackrabbit and I could not get a concrete answer to this question as far as I checked. Hence I m posting the following question:

I need a unique identifier for the documents stored in Jackrabbit (irrespective of whether the documents are stored in File System or DB). I did found a method getIdentifier() in javax.jcr.Node. But not sure whether it unique for each document node inside the repository and whether can I rely on this identfier to fetch the document for updation or deletion?

Basically I m looking for a unique identifier like the one returned from new IDfSysObject().getObjectId().getId() in case of Documentum through which I can back track the document.


Solution

  • The identifier is indeed unique, but it might not be stable (for instance, when the document is moved around).

    You can make it stable though by adding the mixin type "mix:referenceable" (see https://docs.adobe.com/docs/en/spec/jcr/2.0/3_Repository_Model.html#3.8%20Referenceable%20Nodes)