Re: Distinct

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Aug 02 2007 - 16:31:03 EDT

  • Next message: Mike Kienenberger: "Re: Handling search for null relationship"

    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



    This archive was generated by hypermail 2.0.0 : Thu Aug 02 2007 - 16:31:29 EDT