[hibernate-dev] Why does the disassembledStateText in StandardCacheEntryImpl build from the actual state[] and not from disassembledState[]?

Vlad Mihalcea mihalcea.vlad at gmail.com
Wed Nov 29 03:52:10 EST 2017


Hi,

While working on fixing https://hibernate.atlassian.net/browse/HHH-12107,
I realized that the way we create the disassembledStateText property of the
StandardCacheEntryImpl object does not resemble the name of the attribute.

Now, I wonder why we don't build the disassembledStateText from
disassembledState?

Currently, the disassembledStateText is built from the hydrated state
instead. Is there any reason why we do that? Is it for correlating the
disassembledState Object array that's contained in the
StandardCacheEntryImpl object with the original entity hydrated state?

The problem with HHH-12107 was that, from structured 2nd-level cache where
we content is saved as a Map, when we reconstruct the
StandardCacheEntryImpl object
from the Map we get from the 2nd-level cache, we only know the
disassembledState when building the StandardCacheEntryImpl object reference.
So, we can't construct the same disassembledStateText value until we have
the actual hydrated state.

We would not have this issue if the disassembledStateText was built from
the disassembledState Object array via a call to Arrays.deepToString. But
changing the way we build the disassembledStateText is problematic if the
2nd-level cache provider relies on that property.

Vlad


More information about the hibernate-dev mailing list