UnknownTableReferenceException when using composite ids with ManyToOne association

Hello !

I’m facing an issue using spring boot 3.3.3 and hibernate orm 6.5.2.Final.

I have 3 entities with composite ids :

@Table(name = "a")
@Entity
@IdClass(EntityAPK.class)
public class EntityA {

  @Id
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(referencedColumnName = "c_name", name = "c_name")
  @JoinColumn(referencedColumnName = "uid", name = "b_uid")
  private EntityB b;

  @Id
  private UUID id;


}
@Table(name = "b")
@Entity
@IdClass(EntityBPK.class)
public class EntityB {

  @Id
  private String uid;

  @Id
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(referencedColumnName = "name", name = "c_name")
  private EntityC c;
  
}
@Table(name = "c")
@Entity
public class EntityC {

  @Id
  @Column
  private String name;

}

And my two @IdClass :

public class EntityAPK implements Serializable {
  
  private EntityB b;

  private UUID id;

}
public class EntityBPK implements Serializable {

  private String uid;

  private EntityC c;

}

When doing this JPQL query with join fetch :

select a from EntityA a
        join fetch a.b b
        join fetch b.c c

I’m getting the following UnknownTableReferenceException :

org.hibernate.sql.ast.tree.from.UnknownTableReferenceException: Unable to determine TableReference (b) for com.example.springboot3.domain.entities.EntityA(a).{id}.b(b).{id}.c(c).{fk}.

It happens when doing this fetch :

join fetch b.c c

It used to work with spring boot 2.7.
Maybe i’m missing something but everything looks good in the entities configuration.

Can you help me with this issue ?

I’ve created a mini project which reproduce the issue if needed.

Regards.

Does the issue still occur when using Hibernate only? I would suggest upgrading to the latest stable version and if you still get the error please open a Jira issue and attach that reproducer project, thanks.

With spring boot 3.3.4 and the latest stable version of hibernate it is working.

After some tests it was not working with hibernante version 6.5.2 but working again since 6.5.3.

Thank you for your advice.