|
35 | 35 | * and does not force a version increment. |
36 | 36 | * <p> |
37 | 37 | * When an entity is read from the database, its lock mode |
38 | | - * determines whether lost updates and non-repeatable reads |
39 | | - * are possible. |
| 38 | + * determines whether lost updates and non-repeatable reads are |
| 39 | + * possible. Assuming the underlying transaction isolation |
| 40 | + * {@linkplain java.sql.Connection#getTransactionIsolation level} |
| 41 | + * of the current JDBC database connection is at least |
| 42 | + * {@linkplain java.sql.Connection#TRANSACTION_READ_COMMITTED |
| 43 | + * read committed}, then: |
40 | 44 | * <ul> |
41 | 45 | * <li>{@link #NONE} and {@link #READ} prevent lost updates |
42 | 46 | * only for versioned entities, but do not prevent |
43 | 47 | * non-repeatable reads, and do not prevent lost updates |
44 | | - * for entities with no version attribute. |
| 48 | + * for entities with no version attribute; |
45 | 49 | * <li>{@link #OPTIMISTIC} and {@link #OPTIMISTIC_FORCE_INCREMENT} |
46 | 50 | * prevent lost updates and non-repeatable reads only for |
47 | | - * versioned entities. |
| 51 | + * versioned entities; |
48 | 52 | * <li>{@link #PESSIMISTIC_READ}, {@link #PESSIMISTIC_WRITE}, |
49 | 53 | * and {@link #PESSIMISTIC_FORCE_INCREMENT} prevent lost |
50 | 54 | * updates and non-repeatable reads for all entities, |
51 | 55 | * including entities with no version attribute. |
52 | 56 | * </ul> |
53 | 57 | * <p> |
| 58 | + * Regardless of the lock mode of a given entity, a non-repeatable |
| 59 | + * read is always possible when {@link Session#refresh(Object)} |
| 60 | + * is called for that entity, except when the underlying transaction |
| 61 | + * isolation level of the current JDBC database connection is at |
| 62 | + * least {@linkplain java.sql.Connection#TRANSACTION_REPEATABLE_READ |
| 63 | + * repeatable read}. |
| 64 | + * <p> |
54 | 65 | * This enumeration of lock modes competes with the JPA-defined |
55 | 66 | * {@link LockModeType}, but offers additional options, including |
56 | 67 | * {@link #UPGRADE_NOWAIT} and {@link #UPGRADE_SKIPLOCKED}. |
|
0 commit comments