JPQL to SQL translation : wrong column selection using "select new" and "right join"

Hi,

When migrating from springboot 2.7 (hibernate 5.6.14.Final) to springboot 3.1 (hibernate 6.2.6.Final) my generated sql queries from jpql are wrongs.
Inpacted queries are those with “select new” and “right join” : I use this to create a projection called MyProjection from two entities E & C.
I need projection even if entity C is non existant.
I need id of the E entity every time in my projection.

With springboot 2.7 it works (it works for a long time and with anterior springboot versions).
But with springboot 3.1 I encounter a problem : the select always use the entity C forein key to E instead of the id of the E entity.
So, when C is null, the id of the E entity is null in my projection.

Is this a bug ? Or something else ?

Exemple :
Entity C

@Entity
public class EntityC implements Serializable {

  private static final long serialVersionUID = 1L;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  private String reference;

  @ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
  @JoinColumn(name = "entity_e_id")
  private EntityE entityE;


}

Entity E

@Entity
public class EntityE implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String name;


}

My Projection

public class MyProjection implements Serializable {

  private static final long serialVersionUID = -3431863476946276142L;

  private Long entityEId;
  private Long entityCId;

  private String entityEName;
  private String entityCReference;

  public MyProjection(
      Long entityEId,
      Long entityCId,
      String entityEName,
      String entityCReference) {
    this.entityEId = entityEId;
    this.entityCId = entityCId;
    this.entityEName = entityEName;
    this.entityCReference = entityCReference;
  }
  
  public MyProjection(
      Long entityEId,
      Long entityCId) {
    this.entityEId = entityCId;
    this.entityEId = entityCId;
  }

  
  public MyProjection() {}
  
}

Queries
JPQL Query

select new MyProjection(e.id, c.id, e.name, c.reference)
from EntityC c right join c.entityE e;

Springboot 2.7.x Generated SQL

select e1_.id as col_0_0_, c0_.id as col_1_0_, e1_.name as col_2_0_, c0_.reference as col_3_0_
from entity_c c0_ 
right outer join entity_e e1_ on c0_.entity_e_id=e1_.id;

Springboot 3.1.x Generated SQL

select c0_.entity_e_id as col_0_0_, c0_.id as col_1_0_, e1_.name as col_2_0_, c0_.reference as col_3_0_
from entity_c c0_ 
right join entity_e e1_ on c0_.entity_e_id=e1_.id;

Looks like a bug to me. Please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) that reproduces the issue.