1
0
Files
hibernate-demo/docs/output/get-vs-getreference-tests.txt
Ankur Mhatre 7b06d653e4 Add hibernate-demo: get() vs load(), merge() vs refresh(), inserting objects (Hibernate 7.4.1.Final + Spring Boot 4.1.0)
Adds a JUnit test suite (GetVsGetReferenceTest, MergeRefreshTest, OptimisticLockTest,
IdentityBatchTest, SequenceBatchTest, AllocationSizeSweepTest, BatchSizeSweepTest) so every
surprising behavior described in the three companion posts has a reproducible test, alongside
the original CommandLineRunner scenarios. Rewrites all three doc chapters and the README around
the new experiments: the get()/getReference() same-session matrix, the merge()/refresh()
experiments (including exactly when OptimisticLockException surfaces and a corrected LAZY-plus-
cascade merge() result), and two new sweeps (allocationSize, batch_size) for batch inserts.
2026-08-26 18:05:00 +00:00

71 lines
4.4 KiB
Plaintext

Hibernate: select next value for book_seq
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Effective Java]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [1]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [1]
Hibernate: select next value for book_seq
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Domain-Driven Design]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [2]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [2]
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Outlives Session]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [3]
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Matrix: getReference/getReference]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [4]
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Matrix: get/getReference]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [5]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [5]
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Matrix: get/get]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [6]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [6]
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Proxy Identity]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [7]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [7]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [7]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [999111222]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [999333444]
getReference() on a missing id, once accessed, threw: jakarta.persistence.EntityNotFoundException: No row with the given identifier exists for entity [com.ankurm.hibernatedemo.model.Book with id '999333444']
Hibernate: /* insert for com.ankurm.hibernatedemo.model.Book */insert into book (author,status,title,version,id) values (?,?,?,?,?)
binding parameter (1:VARCHAR) <- [Test Author]
binding parameter (2:VARCHAR) <- [null]
binding parameter (3:VARCHAR) <- [Matrix: getReference/get]
binding parameter (4:BIGINT) <- [0]
binding parameter (5:BIGINT) <- [8]
Hibernate: select b1_0.id,b1_0.author,b1_0.status,b1_0.title,b1_0.version from book b1_0 where b1_0.id=?
binding parameter (1:BIGINT) <- [8]
get() after getReference(): prepareStatementCount for this call = 1, returned class = com.ankurm.hibernatedemo.model.Book$HibernateProxy