Mapping jsonb of different types in a class inheritance hierarchy does not work.

Description

Upon upgrading to version 6 of Hibernate, the following code stopped working. It implements a "single table" hierarchy, with EntityA and EntityB classes inheriting from CommonEntity. These classes have properties of different types - PropertyTypeA and PropertyTypeB - which are mapped to columns in the database with a jsonb type.

Hibernate version 6.1.5.Final

When selecting an EntityB object from the database, an exception is thrown:

Attachments

1

Activity

Show:

Paul Lange July 16, 2024 at 11:04 AM

Henning Rohlfs May 3, 2024 at 7:49 AM

See also the related ticket .

Lukas Bauer May 3, 2024 at 7:18 AM

Did you try using a native query?

like this:

entityManager.createNativeQuery("SELECT * FROM abstract_entity", AbstractEntity.class).getResultList();

I think the problem could be related to native queries.

Thomas Bosch May 3, 2024 at 6:23 AM

I also updated to Spring Boot 3.2.5 (including Hibernate 6.4.4.Final). We still have no problems.

Lukas Bauer April 29, 2024 at 1:12 PM

For me it is not working using Spring Boot 3.2.5 and Hibernate 6.4.4.Final

Example can be found here .

Any idea?

Fixed

Details

Assignee

Reporter

Worked in

Components

Sprint

Fix versions

Affects versions

Priority

Created December 22, 2022 at 4:02 PM
Updated July 16, 2024 at 11:04 AM
Resolved June 5, 2023 at 2:49 PM