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 {
@Id
@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> {
@Override
public int getSqlType() {
return Types.BIGINT;
}
@Override
public Class<Foo> returnedClass() {
return Foo.class;
}
@Override
public nullSafeGet(ResultSet resultSet, int i, SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException {
//implementation
//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