Skip to content

Commit c6dc40f

Browse files
committed
migration guide for StatelessSession and second-level cache
1 parent 813f76b commit c6dc40f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

migration-guide.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,19 @@ must be explicitly set to true.
381381

382382
The signature of the `Configurable#configure` method changed from accepting just a `ServiceRegistry` instance to the new `GeneratorCreationContext` interface, which exposes a lot more useful information when configuring the generator itself. The old signature has been deprecated for removal, so you should migrate any custom `Configurable` generator implementation to the new one.
383383

384+
[[stateless-session-cache]]
385+
== `StatelessSession` and second-level cache
386+
387+
Previously, stateless sessions never interacted with the second-level cache.
388+
This reflected their original intended role in bulk processing.
389+
With the advent of Jakarta Data and Hibernate Data Repositories, the responsibilities of `StatelessSession` have now expanded, and this behavior is no longer appropriate.
390+
391+
Thus, a stateless session now makes use of the second-level cache by default.
392+
To completely bypass the second-level cache, recovering the previous behavior, call `setCacheMode(CacheMode.IGNORE)`.
393+
394+
It's often important to explicitly disable puts to the second-level cache in code which performs bulk processing.
395+
Set the cache mode to `GET` or configure `jakarta.persistence.cache.storeMode` to `BYPASS`.
396+
384397
[[stateless-session-jdbc-batching]]
385398
== JDBC batching with `StatelessSession`
386399

0 commit comments

Comments
 (0)