Embeddable type cannot be cast to org.hibernate.usertype.CompositeUserType if referred to from a mapped superclass with generic parameter

Description

Trying to upgrade a project from Hibernate 5 to 6 I run into the following issue:

The rough arrangement looks like this (pseudocode):

org.hibernate.cfg.ClassPropertyHolder.addPropertyToMappedSuperclass(Property, XClass) runs into a special branch of the code if the mapped superclass has generic parameters. In that case, it ultimately ends up calling setTypeName(…) with the type name of the embeddable as parameter. ComponentType later inspects that type name and tries to resolve it in its constructor, unconditionally casting it to CompositeUserType.

Find a reproducer here.

Hope that helps further diagnosing the problem.

Activity

Show:
Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created September 26, 2022 at 1:05 PM
Updated February 23, 2023 at 2:10 PM
Resolved September 30, 2022 at 10:50 AM