Duplicate alias when using Hibernate 6 and QueryDSL

I am upgrading an application to Spring Boot 3 and Hibernate 6.

From:

Spring Boot: 2.7.12
Hibernate: 5.6.15.Final
QueryDSL: 5.0.0

To:
Spring Boot: 3.0.6
Hibernate: 6.1.7.Final
QueryDSL: 5.0.0

When doing queries, I am using projections directly for DTO-less application.

return queryFactory.selectFrom(entity).transform(
        groupBy(entity.id)
            .as(
                (Projections.bean(
                    Details.class,
                   entity.id,
                    Projections.fields(
                            Header.class,
                            entity.customer.as("customer")
                        .as("header"),
                    Projections.bean(
                            DetailsCustomer.class,
                            entity.customer3lc.as("customer")
                        .as("customer");

As you can see, I am using the same alias “customer” twice, which with the new version SQM throws an error:
Alias [customer] is already used in same select clause [position=7]

This may be related to the new SQM tree, and maybe the change from alias to position.

Do you know any workaround or is this the intended behaviour?

Sorry if this is a QueryDSL thing, and not Hibernate.

It’s simply wrong to use the same alias multiple times for different select items. You should remove the .as("customer") part of entity.customer.as("customer") and entity.customer3lc.as("customer").

I don’t know what QueryDSL renders here, so it would be nice if you could also share the generated HQL, though I guess Hibernate 5 just didn’t interpret the alias within the constructor syntax select new Details(.. as customer).