OneToOne relationship in Hibernate 6

Hello, i’m trying to create like this

class ClassA {
@JoinColumn(name = “B”)
private ClassB b;


i create query :
em.createQuery("select a from ClassA a , IN(a.b) ab)

and get error :
Caused by: org.hibernate.query.SemanticException: Expecting plural attribute valued path [com.example.ClassA(a).b(ab)], but found : ClassB

it worked fine on hibernate 5 on both Collections and Single elemets too, but on hibernate 6 it doesn’t work single element.

Thanks beforehand

It just worked by accident. This syntax is from JPQL and is only supposed to support collections. You can just use the proper syntax though:

em.createQuery("select a from ClassA a join a.b ab")

Thanks for answer, this worked fine.

I also have one question please, how can i join on UserType objects with jpql ?
on hibernate 5 i could join, but on hibernate 6 it throws error :
Caused by: java.lang.IllegalArgumentException: Can’t compare test expression of type [BasicSqmPathSource(object : Object.class)] with element of type [BasicSqmPathSource(id : Long)]

Please create a new topic and share more details.