Hibernate 6.0.0.Alpha6 NativeQuery setResultTransformer not working

Description

I'm using NativeQuery with hibernate-core(6.0.0.Alpha6). It has no effect while I use setResultTransformer(include setTupleTransformer or setResultListTransformer). This is the demo I wrote for debugging:

Query nativeQuery = entityManager.createNativeQuery("select t.id as id, t.code as code, t.enum_value as enumValue from my_table t");
nativeQuery.unwrap(NativeQuery.class)
.addScalar("id", LongType.INSTANCE)
.addScalar("code", StringType.INSTANCE)
.addScalar("enumValue", MyEnum.class)
.setResultTransformer(Transformers.aliasToBean(NativeQueryResultDto.class));
List resultList = nativeQuery.getResultList();

The type of element in "resultList" is always Object[]. Finally I found that it was the problem with NativeQueryImpl#createQueryPlan. Tt just returned rowTransformer and it was just defined as null.

Environment

hibernate 6.0.0.Alpha6
spring-boot-dependencies 2.3.4.RELEASE
spring-cloud-dependencies Finchley.RELEASE
jdk 1.8
windows 10
oracle 12

Assignee

Unassigned

Reporter

张路权

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

6.0.0.Alpha6

Components

Affects versions

Priority

Major
Configure