diff --git a/hibernate-core/src/main/java/org/hibernate/LockMode.java b/hibernate-core/src/main/java/org/hibernate/LockMode.java index 6225d7e8254d..6461b926bf63 100644 --- a/hibernate-core/src/main/java/org/hibernate/LockMode.java +++ b/hibernate-core/src/main/java/org/hibernate/LockMode.java @@ -34,6 +34,34 @@ * which any pessimistic lock is already held has no effect, * and does not force a version increment. *

+ * When an entity is read from the database, its lock mode + * determines whether lost updates and non-repeatable reads are + * possible. Assuming the underlying transaction isolation + * {@linkplain java.sql.Connection#getTransactionIsolation level} + * of the current JDBC database connection is at least + * {@linkplain java.sql.Connection#TRANSACTION_READ_COMMITTED + * read committed}, then: + *

+ *

+ * Regardless of the lock mode of a given entity, a non-repeatable + * read is always possible when {@link Session#refresh(Object)} + * is called for that entity, except when the underlying transaction + * isolation level of the current JDBC database connection is at + * least {@linkplain java.sql.Connection#TRANSACTION_REPEATABLE_READ + * repeatable read}. + *

* This enumeration of lock modes competes with the JPA-defined * {@link LockModeType}, but offers additional options, including * {@link #UPGRADE_NOWAIT} and {@link #UPGRADE_SKIPLOCKED}.