I'm trying to understand how to correctly use primary indexes in SDN 4.
From the org.neo4j.ogm.annotation.Index
javadoc:
Only one index per class hierarchy may be marked as primary.
Does it mean that if I have a following entity hierarchy:
B extends A
C extends A
I can't add into the both entities B
and C
the following index definition :
@Index(unique = true, primary = true)
private Long id;
This primary index can be only added to A
or to B
or to C
entity ?
Or if I can add the primary index into the both of them ( B
and C
), can B.id
and C.id
hold the same value.. for example 1
Only one index per class hierarchy may be marked as primary.
This means you can have only 1 primary index in a class, or any of its super classes.
E.g. if you have following hierarchy:
class A
class B extends A
class C extends B
you can have only 1 index, in either A, B or C.
In your situation you can have either index in A, or B (or B and C).
The difference is