Skip to content

Commit afca57a

Browse files
Merge branch '103-shared-global-ids-annotation' into dev
2 parents 7951ab1 + 144f004 commit afca57a

File tree

1 file changed

+14
-0
lines changed
  • objectbox-java-api/src/main/java/io/objectbox/annotation

1 file changed

+14
-0
lines changed

objectbox-java-api/src/main/java/io/objectbox/annotation/Sync.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,18 @@
1414
@Retention(RetentionPolicy.CLASS)
1515
@Target(ElementType.TYPE)
1616
public @interface Sync {
17+
18+
/**
19+
* Set to {@code true} to enable shared global IDs for a {@link Sync}-enabled {@link Entity} class.
20+
* <p>
21+
* By default each Sync client has its own local {@link Id ID} space for Objects.
22+
* IDs are mapped to global IDs when syncing behind the scenes. Turn this on
23+
* to treat Object IDs as global and turn of ID mapping. The ID of an Object will
24+
* then be the same on all clients.
25+
* <p>
26+
* When using this, it is recommended to use {@link Id#assignable() assignable IDs}
27+
* to turn off automatically assigned IDs. Without special care, two Sync clients are
28+
* likely to overwrite each others Objects if IDs are assigned automatically.
29+
*/
30+
boolean sharedGlobalIds() default false;
1731
}

0 commit comments

Comments
 (0)