You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Jan Lendholt <jl...@hotmail.com> on 2007/08/02 17:17:10 UTC

Distinct

Hey all, it's me again.

i tried to set up a statement like this:

SelectQuery q_catering = new SelectQuery(ServiceKundeLocation.class, 
ExpressionFactory.matchExp(ServiceKundeLocation.LID_PROPERTY, 
buchung.getToEvent().getLid()));
q_catering.setDistinct(true);

List caterings = Application.getApp().getContext().performQuery(q_catering);

Instead of getting a DISTINCT operator in the executed sql it is msssing.

Is there a special trick to activate the distinct clause? Or is there a 
memory-based distinction?

Thanks in advance,

Jan

_________________________________________________________________
Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit 
Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu! 
http://desktop.msn.de/ Jetzt gratis downloaden!


Re: Distinct

Posted by Andrus Adamchik <an...@objectstyle.org>.
Cayenne strips DISTINCT if the ResultSet contains one of the  
following columns (since most databases will not tolerate combination  
of DISTINCT and those types) : Types.BLOB, Types.CLOB,  
Types.LONGVARBINARY, Types.LONGVARCHAR


> Or is there a memory-based distinction?

Absolutely right - if DISTINCT was requested, but Cayenne had to  
strip it from the generated SQL, it would do an in memory removal of  
duplicates based on ObjectId comparison:

http://svn.apache.org/repos/asf/cayenne/main/trunk/framework/cayenne- 
jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/util/ 
DistinctResultIterator.java

Andrus



On Aug 2, 2007, at 6:17 PM, Jan Lendholt wrote:
> Hey all, it's me again.
>
> i tried to set up a statement like this:
>
> SelectQuery q_catering = new SelectQuery 
> (ServiceKundeLocation.class, ExpressionFactory.matchExp 
> (ServiceKundeLocation.LID_PROPERTY, buchung.getToEvent().getLid()));
> q_catering.setDistinct(true);
>
> List caterings = Application.getApp().getContext().performQuery 
> (q_catering);
>
> Instead of getting a DISTINCT operator in the executed sql it is  
> msssing.
>
> Is there a special trick to activate the distinct clause? Or is  
> there a memory-based distinction?
>
> Thanks in advance,
>
> Jan