db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kostyantyn Shchekotykhin <Kostyantyn.Shchekotyk...@ifit.uni-klu.ac.at>
Subject Re: AW: Torque, building Criteria for query ...
Date Tue, 02 Mar 2004 10:28:44 GMT
Hi Tino,
You can override Ereignis.toString() method to make it return a valid 
String for a query and then freely use it in Criterias.
E.g. Ereignis.toString() will return something like "1000" (ID of an 
object in the database).
A List.toString() will call toString() of each Ereignis objects and 
return something like this "1000, 1001".
Then your where clause will be "WHERE ID IN (1000, 1001)"
This is a valid SQL and you can write in your code 


> So you used the BaseBeer instead of a generated peer
> like EreignisPeer.doSelect(), because the latter would return 
> Objects of "Ereignis", and Ereignis.toString() also 
> doesn't give an ID-String when submitted to criteria.addNotIn(), right?!
> Best Regards,
> Tino
> -----Ursprüngliche Nachricht-----
> Von: Chris Joelly [mailto:chris.joelly@unycom.com]
> Gesendet: Dienstag, 2. März 2004 10:19
> An: Apache Torque Users List
> Betreff: Re: Torque, building Criteria for query ...
> Hello!
> yep. my problem was the surrounding {} ...
> thx, Chris
> Am Tue, Mar 02, 2004 at 09:37:41AM +0100, Kostyantyn Shchekotykhin meinte:
>>with this method all is ok, the problem was that Chris wanted to add 
>>dicertly a List with Records and not Integers. When BasePeer composes 
>>query each Criterion value is converted to String. Village's 
>>Record.toString() is implemented so that each Record field is surrounded 
>>with {}. E.g. if it contains an Integer it will be something like "WHERE 
>>ID = {1000}".
>>Sperlich, Tino wrote:
>>>you have probably fixed the problem; but just for my info:
>>>in the API of criteria there is a method like this
>>>public Criteria addNotIn(java.lang.String column,
>>>                        java.util.List values)
>>>is there something wrong with this or would that do the job, 

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

View raw message