Hi everyone, I execute a native query via Spring Data JPA and dynamically insert them into a projection interface. The database column definition is a jsonb column and the interface I select into has a field:
the original entity has the backing field defined like this:
With Hibernate 6.1.7.Final it would work because in the method buildJdbcTypeCodeToJavaClassMappings in JdbcTypeJavaClassMappings (see https://github.com/hibernate/hibernate-orm/blob/6.1.7/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/JdbcTypeJavaClassMappings.java#L158 ) there was no mapping defined for the JSON type. Therefore, Object.class has been returned and in the end the Map was passed on as is. With Hibernate 6.2.x and https://hibernate.atlassian.net/browse/HHH-15748 the implementation changed and now JSON is mapped to String.class all times. This causes a ClassCastException during my persistence tests:
I wonder why with the Oracle specific task the mapping has been changed in a central class, since Oracle became its own OracleTypes class. |