java.lang.ClassCastException: org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer$1 cannot be cast to java.lang.String when using envers with bytecode enhancement
Description
Attachments
1
Activity
Show:

Christian Beikov February 19, 2025 at 3:53 PM
Couldn’t reproduce this anymore on ORM 6+:

Anthony Estelita February 20, 2021 at 12:54 AM
We too are seeing this (using Wildfly with Hibernate 5.3.1Final). Anyone have any workarounds for this? It appears this error is being thrown on any objects labeled with @Basic(fetch=FetchType.LAZY) and the object is being updated (saves appear to be working fine though).
Greatly appreciated!

Deno Vichas February 2, 2021 at 6:37 PM
i’m seeing this in 5.4.18
i would love to see this fixed

Xj Chen August 5, 2020 at 7:33 AM
Any news? Meet the same issue.

Nicolas Caballero December 17, 2017 at 5:40 PMEdited
I'm also seeing this issue with OneToOne and NO_PROXY. The issue goes away when I disable the second level cache.
I use hibernate-envers in my project. I tried to enable bytecode enhancement, but during program execution I get following error java.lang.ClassCastException: org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer$1 cannot be cast to java.lang.String.
It seems that error appears when I update only non-lazy fields in entity.
I attach maven project with simple data model and test failing with error described above.
It need to be run by maven test goal to fail as it need to perform bytecode enhancement.