Files
hibernate-demo/docs/output/18-bulk-update-native.txt

10 lines
1.2 KiB
Plaintext

$ mvn -o -B test -Dtest=BulkUpdateBypassesCacheTest#bulkNativeSqlUpdate_alsoDoesNotLeaveTheCacheStale_hibernateInvalidatesEverythingItCannotParse
(trimmed to the test's own RESULT line and the surefire summary for the whole class)
RESULT[cache-bulk-update-native-not-stale]: price in the database after the native SQL update=999.0 | price a brand-new session's get() actually returns=999.0 | L2 puts recorded before the native update=1 | L2 hits before/after the post-update read=1/1 -- the original hypothesis (native SQL bypasses query-space tracking, so the L2 entry survives stale) was WRONG. The entity WAS cached (one L2 put), yet the post-update read is not an L2 hit at all: Hibernate cannot verify a native statement's affected tables, so it conservatively invalidates every region it knows about rather than none of them.
-------------------------------------------------------------------------------
Test set: com.ankurm.hibernatedemo.cache.BulkUpdateBypassesCacheTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.450 s -- in com.ankurm.hibernatedemo.cache.BulkUpdateBypassesCacheTest