Search code examples
neo4jspring-data-neo4jspring-data-neo4j-4neo4j-ogm

Spring Data Neo4j 4.x uniqueness constraint?


Spring Data Neo4j 3.2 had an @Indexed annotation that allowed for a uniqueness constraint which is gone from the 4.x code base.

The best I can tell historically there were two annotations:

import org.neo4j.ogm.annotation.Index;  // 4.0.0.M1
import org.springframework.data.neo4j.annotation.Indexed;  // 3.2

Neither of which appear in any of the later releases:

    <version>4.1.2.RELEASE</version>
    <version>4.1.3.BUILD-SNAPSHOT</version>
    <version>4.2.0.M1</version>

Is there a way to define uniqueness at the Java/Spring level on a field, or does this require working in Cypher and creating the constraint there?


Solution

  • At the moment, SDN 4 does not support @Indexed. However, we will be supporting this in the near future and work is already underway.

    For now though, the only way to do this is via Cypher.