ResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)

233 views
Skip to first unread message

Alireza Hanifi

unread,
Feb 14, 2015, 12:41:58 PM2/14/15
to quer...@googlegroups.com
i have a query with join fetch one to many relations.
query.from(cat)
    .innerJoin(cat.mate, mate).fetch()
    .leftJoin(cat.kittens, kitten).fetch()
    .list(cat);
when i seeing result, the cat entity duplicated to kittens size count. but i want to see one cat with a fetched related kittens property.
when we using Distinct() the problem has solving, but it occurs another problem.
in the cat entity we have BLOB column and we can't use distinct in Oracle db on Blob columns. 
i think answer is using of "setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)" but i couldn't find it in QueryDSL.

timowest

unread,
Feb 14, 2015, 3:35:58 PM2/14/15
to quer...@googlegroups.com
Hi Alireza.

Query provides the GroupBy API for result post processing, but in this case a simple List -> Set -> List transformation might be the best


Timo
Reply all
Reply to author
Forward
0 new messages