Hibernate 6 Joined Inheritance alias injection problem in Native Query

Hi, when using an entity with @Inheritance(strategy = InheritanceType.JOINED) that has some subtypes, the alias syntax {i.*} in a Hibernate native query seems to not resolve the aliases for the subtype tables anymore in Hibernate 6.6.17.Final compared to Hibernate 5.6.15.Final. Assuming, I’m having two subtypes, the rendered select statement used to look something like:

SELECT i.a, i.b, i_1_.c, i_2_.d 

now in Hibernate 6 it seems that each subtype table does not get an alias anymore, e.g.

SELECT i.a, i.b, i.c, i.d 

which leads to errors as the columns do not exist in the table with alias i, e.g. as if we would be using InheritanceType.SINGLE_TABLE. Am I missing some way to tell the native query that it needs to use the joined inheritance type?
Unfortunately, I did not find anything in the official migration guide as well.

I created a reproducer in both Hibernate 5 and Hibernate 6. The Hibernate 6 version raises an error about missing columns, as there are no table aliases inserted in the SQL query for subtype tables when {a.*} is resolved.

Please create a bug ticket in our issue tracker and attach that reproducer.

Created the following ticket:

1 Like