cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Moeser <matth...@ish.com.au>
Subject MS SQL Server: Select Distinct on text datatype
Date Mon, 04 Aug 2008 07:09:26 GMT
Hi!

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)

Mime
View raw message