Spring 规范避免意外的 CROSS JOIN

Spring specification avoid unexpected CROSS JOIN

我有 2 个实体:

public class OrgStructure{

   @Id
   private Long id;

   @ManyToOne
   private OrgStructure parentOrgStructure;

}
public class Device {

   @Id
   private Long id;

   @ManyToOne
   private OrgStructure hospitalRoom
}

我有 1 个生成 CROSS JOIN 查询的规范。我的问题是如何避免像这样不必要的 CROSS JOIN

criteriaBuilder.equal(root.get(Device_.orgStructure).get(OrgStructure_.parentOrgStructure).get(OrganizationStructure_.id), *param goes here*)
The generated query:
SELECT
    *
FROM
    devices device0_
CROSS JOIN org_structures organizati1_
WHERE
    device0_.hospital_room_id = organizati1_.id_organization_structure
    AND organizati1_.organization_structure_id =?

请更改:

root.get(Device_.orgStructure).get(OrgStructure_.parentOrgStructure)

root.join(Device_.orgStructure).join(OrgStructure_.parentOrgStructure)