How to make SDN6 to set node field value from numeric sequence when not set manually?

Viewed 33

I am using Spring Data Neo4j v6 (latest) and need to create nodes with numeric field (customerNumber in example node below). Field should be:

  • either set by client on node creation time (value inside specific range, for example 1-1000)
  • or if not set by client, should get value automatically from numeric sequence (for example starting from 1001)
@Node
data class Customer(
    @Id val id: String,
    val name: String,
    val customerNumber: Long?
)

There is separate @Id field in node, so customerNumber can not be id (if that matters). But customerNumber must still be unique.

Does SDN6 offer some way to implement this?

0 Answers
Related