ClassCastException when updating lazy loaded bytecode enhanced byte
When updating an entities byte field configured as lazy loaded causes the exception:
Caused by: java.lang.ClassCastException: org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer$1 cannot be cast to [B
at org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor.areEqual(PrimitiveByteArrayTypeDescriptor.java:26) <...>
Test passes if I disable "enableLazyInitialization" or cause the field to load (via getter) before I update it.
java 1.8.0_172, windows 10
At the time of this writing 5.2.18.Final was not published on the release page for 5.2. Sorry for the inconvenience.
This bugfix is tagged as 5.2.18, but the release is pending.
I’ve just posted this in the forums: https://discourse.hibernate.org/t/backporting-hhh-12555-to-5-2/5213
Will there be a 5.2.18 release anytime soon?
We REALLY REALLY need this bugfix. :-(
The side effects were on other unrelated parts of my codebase but I'll look into it, cheers!
Might be interesting for us to know about the side effects, maybe we have other things to fix!
Anyway, I created a PR with a proposed fix. Needs some review on this though as I'm not very familiar with this area of the code.
It does, but for a current project enabling it had some unintended side effects. My workaround was to create a user type wrapper around the byte array.