java - How to get unique results from joined Hibernate queries -


this continuation questions this: why hibernate hql distinct cause sql distinct on left join?

you may have noticed findall() repository methods return duplicates, while findall(pageble pageble) works fine.

so, share additional way obtain unique results.

so, let's have @ org.hibernate.hql.internal.ast.querytranslatorimpl

final boolean haslimit = queryparameters.getrowselection() != null && queryparameters.getrowselection().defineslimits(); final boolean needsdistincting = ( query.getselectclause().isdistinct() || haslimit ) && containscollectionfetches(); 

as can see, hibernate apply distincting if define limits. is, if afraid of word distinct in queries , criteria, call javax.persistence.query.setfirstresult(0); , make hibernate apply distincting.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -