Re: MS SQL Server: Select Distinct on text datatype

From: Matthias Moeser (matthia..sh.com.au)
Date: Mon Aug 04 2008 - 03:54:19 EDT

  • Next message: Andrey Razumovsky: "Re: MS SQL Server: Select Distinct on text datatype"

    Hi,

    On 04/08/2008, at 5:49 PM, Lachlan Deck wrote:

    > On 04/08/2008, at 5:39 PM, Andrey Razumovsky wrote:
    >
    >> This is definitely MS SQL's issue, not Cayenne's. Only thing I can
    >> recommend, if you can allow that, select all rows and then seed
    >> out duplicate rows manually
    >
    > AFAIK we are not purposely turning on the flag for obtaining
    > distinct rows. (Well to be fair - we don't have the root stack
    > trace from ROP so can't be certain if we are or not).
    >
    > But AFAIK Cayenne does turn certain queries into select distinct
    > (e.g., joins). Is that right?

    The following, for example, is when trying to delete a record an
    commit the context.

    17:49:47,728 [AWT-EventQueue-0] ERROR ish.view.components.Button :165
    - Failed to perform action
          [java] org.apache.cayenne.CayenneRuntimeException: [v.3.0-
    SNAPSHOT Jul 09 2008 01:28:38] Remote error. URL - http://localhost:
    8181/angel-server-cayenne; CAUSE - class
    com.microsoft.sqlserver.jdbc.SQLServerException The text data type
    cannot be selected as DISTINCT because it is not comparable.
          [java] at
    org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage
    (HessianConnection.java:151)
          [java] at
    org.apache.cayenne.remote.BaseConnection.sendMessage
    (BaseConnection.java:73)
          [java] at org.apache.cayenne.remote.ClientChannel.send
    (ClientChannel.java:281)
          [java] at org.apache.cayenne.remote.ClientChannel.onQuery
    (ClientChannel.java:113)
          [java] at
    org.apache.cayenne.util.ObjectContextQueryAction.runQuery
    (ObjectContextQueryAction.java:317)
          [java] at
    org.apache.cayenne.util.ObjectContextQueryAction.execute
    (ObjectContextQueryAction.java:96)
          [java] at org.apache.cayenne.CayenneContext.onQuery
    (CayenneContext.java:340)
          [java] at org.apache.cayenne.CayenneContext.performQuery
    (CayenneContext.java:328)
          [java] at ish.oncourse.cayenne.CayenneContext.performQuery
    (CayenneContext.java:294)
          [java] at
    org.apache.cayenne.util.RelationshipFault.resolveFromDB
    (RelationshipFault.java:90)
          [java] at
    org.apache.cayenne.util.PersistentObjectList.resolvedObjectList
    (PersistentObjectList.java:301)
          [java] at
    org.apache.cayenne.util.PersistentObjectList.isEmpty
    (PersistentObjectList.java:207)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.relatedObjects
    (ObjectContextDeleteAction.java:204)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.processRules
    (ObjectContextDeleteAction.java:138)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.access$0
    (ObjectContextDeleteAction.java:128)
          [java] at org.apache.cayenne.ObjectContextDeleteAction
    $1.visitToMany(ObjectContextDeleteAction.java:110)
          [java] at
    org.apache.cayenne.reflect.BaseToManyProperty.visit
    (BaseToManyProperty.java:102)
          [java] at
    org.apache.cayenne.reflect.PersistentDescriptor.visitDeclaredProperties(
    PersistentDescriptor.java:338)
          [java] at
    org.apache.cayenne.reflect.PersistentDescriptor.visitProperties
    (PersistentDescriptor.java:371)
          [java] at
    org.apache.cayenne.reflect.LazyClassDescriptorDecorator.visitProperties(
    LazyClassDescriptorDecorator.java:161)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.processDeleteRules
    (ObjectContextDeleteAction.java:104)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.deletePersistent
    (ObjectContextDeleteAction.java:93)
          [java] at
    org.apache.cayenne.ObjectContextDeleteAction.performDelete
    (ObjectContextDeleteAction.java:78)
          [java] at org.apache.cayenne.CayenneContext.deleteObject
    (CayenneContext.java:282)



    This archive was generated by hypermail 2.0.0 : Mon Aug 04 2008 - 03:54:57 EDT