Since [https://hibernate.atlassian.net/browse/HHH-14216|https://hibernate.atlassian.net/browse/HHH-14216|smart-link] will be or already was reverted, a load of an entity with a mappedBy one-to-one association will hit the database instead of the cache, when the association is null. The absence of an entry in the cache is interpreted as “not cached”. What we need though, is a cache entry that represents “nothing there”, so we don’t have to hit the database.
See the discussion on [https://github.com/hibernate/hibernate-orm/pull/5061|https://github.com/hibernate/hibernate-orm/pull/5061|smart-link] and [https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/PR.204221|https://hibernate.zulipchat.com/#narrow/stream/132094-hibernate-orm-dev/topic/PR.204221|smart-link] for more details. |
|