@@ -215,6 +215,7 @@ default void onCollectionRemove(Object collection, Object key) {
215215 */
216216 default void onCollectionUpdate (Object collection , Object key ) {
217217 }
218+
218219 /**
219220 * Called before a flush.
220221 *
@@ -223,32 +224,37 @@ default void onCollectionUpdate(Object collection, Object key) {
223224 default void preFlush (Iterator <Object > entities ) {}
224225
225226 /**
226- * Called after a flush that actually ends in execution of the SQL statements required to synchronize
227- * in-memory state with the database.
227+ * Called after a flush that actually ends in execution of the SQL statements
228+ * required to synchronize in-memory state with the database.
228229 *
229230 * @param entities The entities that were flushed.
230231 */
231232 default void postFlush (Iterator <Object > entities ) {}
232233
233234 /**
234- * Called to distinguish between transient and detached entities. The return value determines the
235- * state of the entity with respect to the current session.
235+ * Called to distinguish between transient and detached entities. The return
236+ * value determines the state of the entity with respect to the current session.
237+ * This method should return:
236238 * <ul>
237- * <li>{@code Boolean.TRUE} - the entity is transient
238- * <li>{@code Boolean.FALSE} - the entity is detached
239- * <li>{@code null} - Hibernate uses the {@code unsaved-value} mapping and other heuristics to
240- * determine if the object is unsaved
239+ * <li>{@code Boolean.TRUE} if the entity is transient,
240+ * <li>{@code Boolean.FALSE} if the entity is detached, or
241+ * <li>{@code null} to signal that the usual heuristics should be used to determine
242+ * if the instance is transient
241243 * </ul>
244+ * Heuristics used when this method returns null are based on the value of the
245+ * {@linkplain jakarta.persistence.GeneratedValue generated} id field, or the
246+ * {@linkplain jakarta.persistence.Version version} field, if any.
242247 *
243248 * @param entity a transient or detached entity
244- * @return Boolean or {@code null} to choose default behaviour
249+ * @return {@link Boolean} or {@code null} to choose default behaviour
245250 */
246251 default Boolean isTransient (Object entity ) {
247252 return null ;
248253 }
249254
250255 /**
251- * Called from {@code flush()}. The return value determines whether the entity is updated
256+ * Called from {@code flush()}. The return value determines whether the entity
257+ * is updated
252258 * <ul>
253259 * <li>an array of property indices - the entity is dirty
254260 * <li>an empty array - the entity is not dirty
@@ -258,11 +264,13 @@ default Boolean isTransient(Object entity) {
258264 * @param entity The entity for which to find dirty properties.
259265 * @param id The identifier of the entity
260266 * @param currentState The current entity state as taken from the entity instance
261- * @param previousState The state of the entity when it was last synchronized (generally when it was loaded)
267+ * @param previousState The state of the entity when it was last synchronized
268+ * (generally when it was loaded)
262269 * @param propertyNames The names of the entity properties.
263270 * @param types The types of the entity properties
264271 *
265- * @return array of dirty property indices or {@code null} to indicate Hibernate should perform default behaviour
272+ * @return array of dirty property indices or {@code null} to indicate Hibernate
273+ * should perform default behaviour
266274 */
267275 default int [] findDirty (
268276 Object entity ,
@@ -275,9 +283,9 @@ default int[] findDirty(
275283 }
276284
277285 /**
278- * Instantiate the entity. Return {@code null} to indicate that Hibernate should use
279- * the default constructor of the class. The identifier property of the returned instance
280- * should be initialized with the given identifier.
286+ * Instantiate the entity. Return {@code null} to indicate that Hibernate should
287+ * use the default constructor of the class. The identifier property of the
288+ * returned instance should be initialized with the given identifier.
281289 */
282290 default Object instantiate (
283291 String entityName ,
@@ -287,9 +295,9 @@ default Object instantiate(
287295 }
288296
289297 /**
290- * Instantiate the entity. Return {@code null} to indicate that Hibernate should use
291- * the default constructor of the class. The identifier property of the returned instance
292- * should be initialized with the given identifier.
298+ * Instantiate the entity. Return {@code null} to indicate that Hibernate should
299+ * use the default constructor of the class. The identifier property of the
300+ * returned instance should be initialized with the given identifier.
293301 */
294302 default Object instantiate (
295303 String entityName ,
@@ -324,9 +332,10 @@ default Object getEntity(String entityName, Object id) {
324332 }
325333
326334 /**
327- * Called when a Hibernate transaction is begun via the Hibernate {@code Transaction}
328- * API. Will not be called if transactions are being controlled via some other
329- * mechanism (CMT, for example).
335+ * Called when a Hibernate transaction is begun via the JPA-standard
336+ * {@link jakarta.persistence.EntityTransaction} API, or via {@link Transaction}.
337+ * This method is not be called if transactions are being controlled via some
338+ * other mechanism, for example, if transactions are managed by a container.
330339 *
331340 * @param tx The Hibernate transaction facade object
332341 */
0 commit comments