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 Rob Broadhead <ro...@mindspring.com> on 2004/02/27 16:15:30 UTC

Criteria with a like

I am doing a select with a like as shown below and I have to enter the 
column name as a string instead of using the static member of the peer. If 
I use the member then it builds the sql to find 
tablename.tablename.columnname instead of tablename.columnname is this me 
using the API incorrectly or is it something I set wrong when generating 
the peers? I am using torque 3.1 with Postgres if that helps.

String name = "test client%";
Criteria crit = new Criteria;
crit.add(ClientsPeer.TABLE_NAME,"CLIENTNAME",name,Criteria.LIKE); // works

// 
crit.add(ClientsPeer.TABLE_NAME,ClientsPeer.CLIENTNAME,name,Criteria.LIKE); 
// does not work

Thanks,
Rob



//--------------------------------------------------------------------
Rob Broadhead - Consultant
RB Consulting Inc.
Rob@RB-SNS.com
//-------------------------------------------------------------------- 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Criteria with a like

Posted by Scott Eade <se...@backstagetech.com.au>.
Rob Broadhead wrote:

> I am doing a select with a like as shown below and I have to enter the 
> column name as a string instead of using the static member of the 
> peer. If I use the member then it builds the sql to find 
> tablename.tablename.columnname instead of tablename.columnname is this 
> me using the API incorrectly or is it something I set wrong when 
> generating the peers? I am using torque 3.1 with Postgres if that helps.
>
> String name = "test client%";
> Criteria crit = new Criteria;
> crit.add(ClientsPeer.TABLE_NAME,"CLIENTNAME",name,Criteria.LIKE); // 
> works
>
> // 
> crit.add(ClientsPeer.TABLE_NAME,ClientsPeer.CLIENTNAME,name,Criteria.LIKE); 
> // does not work

Try:

    crit.add(ClientsPeer.CLIENTNAME, name, Criteria.LIKE);

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org