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

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

python - How to use Celery in Tornado with redis as broker and backend? -