@Retention(value=RUNTIME) @Target(value=FIELD) public @interface PrimaryKey
RealmPrimaryKeyConstraintException
. Primary key cannot be changed
after the object created.
Primary keys also count as having the Index
annotation.
It is allowed to apply this annotation on the following primitive types: byte, short, int, and long.
String, Byte, Short, Integer, and Long are also allowed, and further permitted to have null
as a primary key value.
This annotation is not allowed inside Realm classes marked as \@RealmClass(embedded = true)
.