1 Reply Latest reply on Jan 18, 2011 8:53 AM by rhauch

    Custom identifiers

    dimonv

      Hi all,

       

      can anybody write me whether it is possible to define a custom identifier on a node type?

       

      Thanks

        • 1. Custom identifiers
          rhauch

          Dimitri,

           

          It is not possible to have ModeShape return a different value from Node.getIdentifier(). ModeShape always returns the node's UUID, regardless of whether the node is 'mix:referenceable'.

           

          Of course, you can always define any property and treat it as a unique identifier, and use a query to find the node (or nodes if not unique) with that property value. For example, you could define a node type similar to 'mix:referenceable' with your custom identifier property, and add that mixin to individual nodes and/or as a supertype for your other custom node types. Unfortunately, the JCR specification doesn't really provide a way to specify that each value defined by a property definition is globally unique, so if uniqueness is important, you'll just have to use some type of value that is unique enough for your system.

           

          I hope that answers your question.

          1 of 1 people found this helpful