Multi selection and distinct in a criteria query

#1

hi,

How can I realize multi selection with the criteria api concerning distinct?

I.e. doing something like SELECT DISTINCT $1, $2 wouldn't work because I do only have something like criteria.multiselect(...) and nothing like builder.distinct(selection) so that I could do something like criteria.multiselect(builder.distinct($1), $2)... ??

Alex

#2
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Ok yes I am aware of that sorry ;) What I was trying to say.. how can I restrict the DISTINCT to the first selection element in my tuple selection only? I.e. I don't want to every selection expression being distinct (i.e. when selecting names which may double without troubles)

 

Alex

#4

I am afraid it is not supported neither in JPQL nor in criteria queries.

But does it make sense?

Results with identical 2nd element will not be filtered anyway if the first element is different. Only results in which all the elements are identical are filtered.

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

aaahh.. okay that explains it. Well then it should work nevertheless I hope.. :)


Post Reply

To post a reply and/or subscribe to update notifications - please login