Skip to content

Commit 88e6972

Browse files
Docs: put updates target objects for any ToMany based on Backlink
1 parent 997630e commit 88e6972

File tree

1 file changed

+9
-8
lines changed
  • objectbox-java/src/main/java/io/objectbox

1 file changed

+9
-8
lines changed

objectbox-java/src/main/java/io/objectbox/Box.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.annotation.Nullable;
2929
import javax.annotation.concurrent.ThreadSafe;
3030

31+
import io.objectbox.annotation.Backlink;
3132
import io.objectbox.annotation.Id;
3233
import io.objectbox.annotation.apihint.Beta;
3334
import io.objectbox.annotation.apihint.Experimental;
@@ -344,19 +345,19 @@ public boolean contains(long id) {
344345
* available ID. For example, if there is an object with ID 1 and another with ID 100, it will be assigned ID 101.
345346
* The new ID is also set on the given object before this returns.
346347
* <p>
347-
* If instead the object has an assigned ID set, if an object with the same ID exists it will be updated.
348-
* Otherwise, it will be inserted with that ID.
348+
* If instead the object has an assigned ID set, if an object with the same ID exists it is updated. Otherwise, it
349+
* is inserted with that ID.
349350
* <p>
350351
* If the ID was not assigned before an {@link IllegalArgumentException} is thrown.
351352
* <p>
352353
* When the object contains {@link ToOne} or {@link ToMany} relations, they are created (or updated) to point to the
353-
* (new) target objects.
354-
* The target objects themselves are not updated or removed. To do so, put or remove them using their box.
355-
* However, for convenience, if a target object is new, it will be inserted and assigned an ID in its box before
356-
* creating or updating the relation.
354+
* (new) target objects. The target objects themselves are typically not updated or removed. To do so, put or remove
355+
* them using their {@link Box}. However, for convenience, if a target object is new, it will be inserted and
356+
* assigned an ID in its Box before creating or updating the relation. Also, for ToMany relations based on a
357+
* {@link Backlink} the target objects are updated (to store changes in the linked ToOne or ToMany relation).
357358
* <p>
358-
* Performance note: if you want to put several objects, consider {@link #put(Collection)},
359-
* {@link #put(Object[])}, {@link BoxStore#runInTx(Runnable)}, etc. instead.
359+
* Performance note: if you want to put several objects, consider {@link #put(Collection)}, {@link #put(Object[])},
360+
* {@link BoxStore#runInTx(Runnable)}, etc. instead.
360361
*/
361362
public long put(T entity) {
362363
Cursor<T> cursor = getWriter();

0 commit comments

Comments
 (0)