我的查询在使用 sql explorer 运行时返回 662 行,当我使用 hibernate 在代码中运行它时,它返回 856 行...我尝试使用集合并以这种方式删除重复项但显然没有任何重复...
询问:
String queryString = "FROM AEntity AS A " +
"LEFT JOIN A.bEntityAS B " +
"WHERE A.INIT||A.NUM IN (:carList) AND A.INIT IN (:initList) AND A.NUM IN (:numberList) " +
"AND B.TRUK_AXL_CNT > 0";
课程
public class BEntity implements Serializable{
@Id
@Column(name = "NUM")
private String num;
@Id
@Column(name = "INIT")
private String init;
@Column(name = "V_CNT")
private Integer vcnt;
}
public class AEntity implements Serializable{
@Id
@Column(name = "NUM")
private String num;
@Id
@Column(name = "INIT")
private String init;
@OneToOne
@PrimaryKeyJoinColumns({
@PrimaryKeyJoinColumn(name="NUM", referencedColumnName="NUM"),
@PrimaryKeyJoinColumn(name="INIT", referencedColumnName="INIT")
})
private BEntity bEntity;
}