Hibernate 6.2 Query Path comparison does not take AttributeConverter into consideration

After upgrading to Hibernate 6.2 from 5.x, some of our HQLs stopped working. I believe it’s due to the new “Query Path comparison” check (6.0 Migration Guide).

Example:

Entities, types, and AttributeConverter:

@Entity
public class Order {
    @Convert(converter = UserIdAttributeConverter.class)
    private UserId userId;  // column SQL type: long, FK to user.id
}

public class UserId {
    private Long id;
}

@Entity
public class User {
    private Long id;  // column SQL type: long
}

@Converter
public class UserIdAttributeConverter extends AttributeConverter<UserId, Long> {
    ...
}

The above declarations still work for entity persistence, and prior to the upgrade, the following query had worked:

    from Order o
    inner join User u on u.id = o.userId

Now, we got error:

Can’t compare test expression of type [BasicSqmPathSource(id : Long)] with element of type [BasicSqmPathSource(userId : UserId)]

I do understand and agree with the type checks on the query paths. However, shouldn’t the check consider the AttributeConverter declared on the attribute? It clearly indicated that the attribute should be treated as a Long in the database.

Which exact version are you using? AFAIU, this should have been fixed via [HHH-16241] - Hibernate JIRA.

@beikov Thank you for your response.

I was mistaken in my original post. Our current hibernate version (hibernate-core) is 6.3.1.Final

Thank you.

Please try to create a reproducer with our test case template (hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) and if you are able to reproduce the issue, create a bug ticket in our issue tracker(https://hibernate.atlassian.net) and attach that reproducer.

@beikov Sorry, my bad. False alarm. I did the initial test but did not test it again after my coworker upgraded to hibernate 6.3.1. I verified that the problem no longer exists for version 6.3.1. I guess when I first tested it, the version must be 6.1.x.

Thank you. Really appreciate your response.