Search code examples
orientdb

OrientDB use cluster position as an identifier


I would like to have an auto-increment identifier on my persisted orientdb entities.

The id in an orient database is the RecordID. It is composed of two parts (cluster:position)

  • cluster, is the cluster id.
  • position, is the absolute position of the record inside a cluster.

I saw in the documentation that by default OrientDB creates 1 cluster per class. Since there is one entity class per cluster. Is it possible to use only the RecordID position as an identifier (unique for a class) for my objects ?


Solution

  • Absolutely yes. The RID is never recycled, even on record deletion and represents the record as unique object in a database.