db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Kromkamp" <r.kromk...@pagelink.nl>
Subject RE: AW: Joins and performance
Date Fri, 01 Jun 2007 14:29:20 GMT
Hi!

I found this link: http://www.mail-archive.com/torque-user@db.apache.org/msg03571.html 

Robert

-----Original Message-----
From: Alvaro Coronel [mailto:alvarocoronel67@yahoo.com] 
Sent: Friday, June 01, 2007 4:05 PM
To: Apache Torque Users List
Subject: Re: AW: Joins and performance

That sounds _very_ useful ! 

Robert, could you post the link if you find it?

Thanks in advance,
Álvaro.

"Vitzethum, Daniel" <Daniel.Vitzethum@gigatronik.com> wrote: Hi Robert,

> If I've 100 companies (which are schools) and 200 buildings, I will 
> executes 100 * 200 queries to get all the employees.

be sure to avoid this... sounds like a killer ;-)

> In low level SQL
> this query can be combined in one query. Is there a way to handle this 
> within Torque?

In Torque, you can use the Criteria.addJoin() method to link two tables.


Using that feature, you cannot use the Peer.doSelect() method, but have to use Peer.doSelectVillageRecords(),
which will return all columns of all joined tables in a village Record object, with no big
difference to plain JDBC in handling. If you need or want Torque data objects, you have to
extract them one by one from the result set.

For a project of us, we wrote a helper class named JoinHelper that does this business for
you AND returns an tree of Torque objects. In your case, it would return COMPANY objects that
can be queried for their BUILDINGs, which again know their EMPLOYEEs.

Please search the thread about two years ago in Torque archive and the discussion about. JoinHelper
massively uses reflection, but is tested quite well and in production. If you have more detailled
questions...
you're welcome.


Daniel

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



       
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel. 

---------------------------------------------------------------------
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