cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Razumovsky" <razumovsky.and...@gmail.com>
Subject Re: MS SQL Server: Select Distinct on text datatype
Date Mon, 04 Aug 2008 08:24:39 GMT
I've looked at the code a bit. Turns out there're some
UNSUPPORTED_DISTINCT_TYPES in SelectTranslator class. Probably if "text"
type will be added there, this would let go the exceptions. I'll advice to
open a JIRA issue about it.
By now you could try use SQLTemplate. It will not generate any "distinct"
modifiers.

By the way, it seems quite strange to me, that Cayenne adds ''distinct'
modifiers automatically e.g. when selecting prefetches, even if
SelectQuery.isDistinct returns false (and it does by default).

2008/8/4, Matthias Moeser <matthias@ish.com.au>:
>
> 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)
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message