You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by KERNEUZET FREDERIC <Fr...@pr-gicm.com> on 2005/03/01 14:17:48 UTC
Problem with setDistinct()
Hi everyone,
I've got a problem with something quite "easy", and besides, already used in another place in my application ...
The source code is :
====================
ArrayList listRole = new ArrayList();
listRole.add("Correspondant");
criteria.addJoin( SalariePeer.USER_ID, TurbineUserGroupRolePeer.USER_ID );
criteria.addJoin(TurbineRolePeer.ROLE_ID, TurbineUserGroupRolePeer.ROLE_ID);
criteria.addNotIn(TurbineRolePeer.ROLE_NAME,listRole);
criteria.setDistinct();
List lstSalarie = SalariePeer.doSelect(criteria);
====================
It gives me an sql request without any column selected :
SELECT DISTINCT FROM TURBINE_ROLE, SALARIE, TURBINE_USER_GROUP_ROLE WHERE TURBINE_ROLE.ROLE_NAME NOT IN ('Correspondant') AND SALARIE.USER_ID=TURBINE_USER_GROUP_ROLE.USER_ID AND TURBINE_ROLE.ROLE_ID=TURBINE_USER_GROUP_ROLE.ROLE_ID
And an java.sql.Exception in thrown :
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Data type like text, ntext or image cannot be selected as DISTINCT.
(error message translated from french)
As someone got an idea ?
Thanks !
==================================
Frédéric Kerneuzet
==================================
RE: Problem with setDistinct()
Posted by Thomas Fischer <fi...@seitenbau.net>.
Hi,
its just as it says: some datasets do not support DISTINCT with some
datatypes. No problem of Torque, but of the database.
I got no clean solution, only if your content is short enough then you can
use VARCHAR instead of whatever datatype you use and it should work then.
Thomas
"KERNEUZET FREDERIC" <Fr...@pr-gicm.com> schrieb am 01.03.2005
14:17:48:
> Hi everyone,
>
> I've got a problem with something quite "easy", and besides, already
> used in another place in my application ...
>
> The source code is :
> ====================
> ArrayList listRole = new ArrayList();
> listRole.add("Correspondant");
>
> criteria.addJoin( SalariePeer.USER_ID, TurbineUserGroupRolePeer.USER_ID
);
> criteria.addJoin(TurbineRolePeer.ROLE_ID, TurbineUserGroupRolePeer.
> ROLE_ID);
> criteria.addNotIn(TurbineRolePeer.ROLE_NAME,listRole);
>
> criteria.setDistinct();
>
> List lstSalarie = SalariePeer.doSelect(criteria);
> ====================
>
> It gives me an sql request without any column selected :
> SELECT DISTINCT FROM TURBINE_ROLE, SALARIE, TURBINE_USER_GROUP_ROLE
> WHERE TURBINE_ROLE.ROLE_NAME NOT IN ('Correspondant') AND SALARIE.
> USER_ID=TURBINE_USER_GROUP_ROLE.USER_ID AND TURBINE_ROLE.
> ROLE_ID=TURBINE_USER_GROUP_ROLE.ROLE_ID
>
> And an java.sql.Exception in thrown :
> java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]
> [SQLServer]Data type like text, ntext or image cannot be selected
asDISTINCT.
>
> (error message translated from french)
>
> As someone got an idea ?
>
>
> Thanks !
> ==================================
> Frédéric Kerneuzet
> ==================================
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org