@@ -128,7 +128,9 @@ public ToOne(Object sourceEntity, RelationInfo<?, TARGET> relationInfo) {
128
128
}
129
129
130
130
/**
131
- * @return The target entity of the to-one relation.
131
+ * Returns the target object or {@code null} if there is none.
132
+ * <p>
133
+ * {@link ToOne} uses lazy initialization, so on first access this will read the target object from the database.
132
134
*/
133
135
public TARGET getTarget () {
134
136
return getTarget (getTargetId ());
@@ -193,10 +195,11 @@ public boolean isNull() {
193
195
}
194
196
195
197
/**
196
- * Sets or clears the target ID in the source entity. Pass 0 to clear.
198
+ * Prepares to set the target of this relation to the object with the given ID. Pass {@code 0} to remove an existing
199
+ * one.
197
200
* <p>
198
- * Put the source entity to persist changes.
199
- * If the ID is not 0 creates a relation to the target entity with this ID, otherwise dissolves it .
201
+ * To apply changes, put the object with the ToOne. For important details, see the notes about relations of
202
+ * {@link Box#put(Object)} .
200
203
*
201
204
* @see #setTarget
202
205
*/
@@ -224,10 +227,10 @@ void setAndUpdateTargetId(long targetId) {
224
227
}
225
228
226
229
/**
227
- * Sets or clears the target entity and ID in the source entity . Pass null to clear .
230
+ * Prepares to set the target object of this relation . Pass {@code null} to remove an existing one .
228
231
* <p>
229
- * Put the source entity to persist changes.
230
- * If the target entity was not put yet (its ID is 0), it will be stored when the source entity is put .
232
+ * To apply changes, put the object with the ToOne. For important details, see the notes about relations of
233
+ * {@link Box# put(Object)} .
231
234
*
232
235
* @see #setTargetId
233
236
*/
0 commit comments