Files
hibernate8-jpa4-demo/output/05-lock-modes-in-entityagent.txt

46 lines
2.0 KiB
Plaintext

=== H2 ===
get(Book.class, "978-1", OPTIMISTIC)
right after get() (1 statement)
select b1_0.isbn,b1_0.price,b1_0.publisher_id,b1_0.title,b1_0.version,b1_0.views from book b1_0 where b1_0.isbn=? for update
during commit (0 statements)
version before: 0, after: 0
get(Book.class, "978-1", OPTIMISTIC_FORCE_INCREMENT)
right after get() (2 statements)
select b1_0.isbn,b1_0.price,b1_0.publisher_id,b1_0.title,b1_0.version,b1_0.views from book b1_0 where b1_0.isbn=? for update
update book set version=? where isbn=? and version=?
during commit (0 statements)
version before: 0, after: 1
get(Book.class, "978-1", PESSIMISTIC_WRITE)
right after get() (1 statement)
select b1_0.isbn,b1_0.price,b1_0.publisher_id,b1_0.title,b1_0.version,b1_0.views from book b1_0 where b1_0.isbn=? for update
during commit (0 statements)
version before: 1, after: 1
get(Book.class, "978-1", PESSIMISTIC_FORCE_INCREMENT)
right after get() (2 statements)
select b1_0.isbn,b1_0.price,b1_0.publisher_id,b1_0.title,b1_0.version,b1_0.views from book b1_0 where b1_0.isbn=? for update
update book set version=? where isbn=? and version=?
during commit (0 statements)
version before: 1, after: 2
=== HSQLDB ===
get(Book.class, "978-1", OPTIMISTIC)
FAILED: org.hibernate.HibernateException: Stateless optimistic locking requires transaction-long row protection; no strategy established for HSQLDialect:2:LOCKING
get(Book.class, "978-1", OPTIMISTIC_FORCE_INCREMENT)
FAILED: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "owner" is null
get(Book.class, "978-1", PESSIMISTIC_WRITE)
right after get() (1 statement)
select b1_0.isbn,b1_0.price,b1_0.publisher_id,b1_0.title,b1_0.version,b1_0.views from book b1_0 where b1_0.isbn=? for update
during commit (0 statements)
version before: 0, after: 0
get(Book.class, "978-1", PESSIMISTIC_FORCE_INCREMENT)
FAILED: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "owner" is null