db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thoralf Rickert" <thoralf.rick...@cadooz.de>
Subject AW: Problems to set up a subquery
Date Fri, 20 Oct 2006 10:44:35 GMT
You have three options:

Overwrite toString and return the KundenaddressId that is set in the reference (because that
is what you want).

The other solution is to make a doSelectVillageRecords (that returns only the columns that
you have ask for with subCriteria.addSelectColumn()). The doSelectVillageRecords would return
a list of Village Record objects. But you don't have access to the toString() method, so you
have to extract the values in an extra array...

The third method is to use a join.

The third method seems to be the best, because everything else results in two select queries
(first to get Adressreferenz Ids and then to make the IN-Query).

> -----Urspr√ľngliche Nachricht-----
> Von: Pfiester, Jan [mailto:jan.pfiester@ict.fraunhofer.de] 
> Gesendet: Freitag, 20. Oktober 2006 12:18
> An: Apache Torque Users List
> Betreff: AW: Problems to set up a subquery
> 
> 
> Well, it is some real code...
> 
> > Did you overwrite the toString() method in Adressreferenz?
> No, I did'nt.  
> 
> >  but my Torque version (3.2) uses toString() to create the 
> query. The 
> > > generated toString() method in BaseAdressreferenz is nice for 
> > debugging but useless for sql-queries...
> 
> So what are you doing in the overwritten toString() method?
> Do you just build together a subselect-querystring 
> arrayobject according to the returned result objects? Don't 
> you have to hard code row references again (see the 
> custom-tag), which is what i'm trying to avoid.
> 
> Bye
> Jan
> 
> 
> -----Urspr√ľngliche Nachricht-----
> Von: Thoralf Rickert [mailto:thoralf.rickert@cadooz.de] 
> Gesendet: Freitag, 20. Oktober 2006 11:24
> An: Apache Torque Users List
> Betreff: AW: Problems to set up a subquery
> 
> 
> > Sort of a "clean" approach, but not working due sql exections: [...]
> > 	criteria.addNotIn(KundenadressePeer.KUNDENADRESS_ID,
> > AdressenreferenzPeer.doSelect(subCriteria));
> > [...]
> 
> Just a question because I'm not sure if you just show an 
> example or the real code, that you're using. The doSelect() 
> method in your addNotIn() returns a list of Adressreferenz 
> objects. If you put this into a addNotIn - I think the 
> query-generation-process uses the String representation of 
> these Adressreferenz objects to create the sql-query. Did you 
> overwrite the toString() method in Adressreferenz? I'm not 
> sure, if you have to do this, but my Torque version (3.2) 
> uses toString() to create the query. The generated toString() 
> method in BaseAdressreferenz is nice for debugging but 
> useless for sql-queries, I think.
> 
> bye
> Thoralf
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


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


Mime
View raw message