HIbernate ORM UserType mapping

Hello, how can i join on UserType objects with jpql ?
in hibernate 5 it worked fine , but on hibernate 6 it throws error :
Caused by: java.lang.IllegalArgumentException: Can’t compare test expression of type [BasicSqmPathSource(foo: Foo.class)] with element of type [BasicSqmPathSource(id : Long)]

this is my entity representation

public class A  {

    @Column(name = "ID")
    private long id;

    @Column(name = "FOO")
    @Type(value = com.example.foo.FooUserType.class)
    private Foo foo;

//getters and setters

public class FooUserType  implements UserType< Foo>  {
    public int getSqlType() {
        return Types.BIGINT;

    public Class<Foo> returnedClass() {
        return Foo.class;

    public nullSafeGet(ResultSet resultSet, int i, SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException {

//return new Foo();


Foo is foreign key to another table and in getter method i fetch data and set to my object,

em.createQuery("select a from FooTable f inner join a.foo=f.id")

this query in hibernate 5 had compilation error, but when i ran it it joined fine, but in hibernate 6 gives me error, which i have alreadey mentioned.

Thanks forehead

We are aware of this and are in the process of fixing. Also see HHH-17693 Cannot use 'like' operand when an AttributeConverter is used to convert the attribute in a String by mbladel · Pull Request #7768 · hibernate/hibernate-orm · GitHub

Thanks for the answer and In which version will it be fixed?

See Maintenance Policy - Hibernate for details.