cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lachlan Deck <lachlan.d...@gmail.com>
Subject Re: MS SQL Server: Select Distinct on text datatype
Date Mon, 04 Aug 2008 07:49:15 GMT
Hi there,

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?

> 2008/8/4, Matthias Moeser <matthias@ish.com.au>:
>>
>> We are using Cayenne with Microsoft SQL Server. We get a
>> com.microsoft.sqlserver.jdbc.SQLServerException: "The text data  
>> type cannot
>> be selected as DISTINCT because it is not comparable."
>>
>> The problem is that the following query is not allowed in MS SQL  
>> Server:
>>
>> SELECT DISTINCT column FROM table;
>>
>> where "column" is of datatype "text". So i think that cayenne does
>> somewhere such a DISTINCT query on a "text" datatype column.
>>
>> The datatype "text" in MS SQL server is a variable-length data with a
>> maximum length of 2^31 - 1 (2,147,483,647) characters, Varchar()  
>> can have
>> only maximum 8000 character.
>>
>> What can I do? I need the "text" datatype.
>>
>> Thank you
>> Matthias
>>
>>
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>> at
>> org.mortbay.jetty.bio.SocketConnector 
>> $Connection.run(SocketConnector.jav
>> a:228)
>> at
>> org.mortbay.thread.BoundedThreadPool 
>> $PoolThread.run(BoundedThreadPool.ja
>> va:450)
>> Caused by: java.lang.Exception: The text data type cannot be  
>> selected as
>> DISTINCT because it is not comparable.
>> com.microsoft.sqlserver.jdbc.SQLServerException: The text data type
>> cannot be selected as DISTINCT because it is not comparable.
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Un
>> known Source)
>> at
>> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
>> Source)
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePrepare
>> dStatement(Unknown Source)
>> at
>> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement 
>> $PrepStmtExecCmd.
>> doExecute(Unknown Source)
>> at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown
>> Source)
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
>> Source)
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
>> Source)
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
>> Source)
>> at
>> com 
>> .microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unk
>> nown Source)
>> at
>> org 
>> .apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.j
>> ava:73)
>> at
>> org 
>> .apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryActi
>> on.java:58)
>>

with regards,
--

Lachlan Deck




Mime
View raw message