这是对此类问题的延续: why does hibernate hql distinct cause an sql distinct on left join?
您可能已经注意到var alerted = localStorage.getItem('alerted') || '';
if (alerted != 'yes') {
if (value.squawk == "7500" || value.squawk == "7600" ||value.squawk == "7700") {
console.log(value.hex + " is squawking " + value.squawk);
alert(value.hex + " is squawking " + value.squawk + ". This is usually an error in transponder transmission please DO NOT alert the local authorities");
markers[value.hex].setIcon(squawkerror(value));
}
} else
存储库方法返回重复项,而findAll()
工作正常。
所以,我想分享额外的方法来获得独特的结果。
答案 0 :(得分:0)
所以,让我们看一下findAll(Pageble pageble)
org.hibernate.hql.internal.ast.QueryTranslatorImpl
正如您所看到的,如果您定义限制,Hibernate将应用区别。也就是说,如果您在查询和标准中害怕单词final boolean hasLimit = queryParameters.getRowSelection() != null && queryParameters.getRowSelection().definesLimits();
final boolean needsDistincting = ( query.getSelectClause().isDistinct() || hasLimit ) && containsCollectionFetches();
,只需调用distinct
,这将使Hibernate适用于区别。