db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: doSelect with collections filled
Date Thu, 02 Sep 2004 08:25:43 GMT

    Did you defined the foreign key relationship beetwen  Author and 
Book in your schema file?
If yes, there should be protected method in BaseAuthorPeer
doSelectJoinBooks() (or something like that). Write this method as 
public in AuthorPeer
and than you can use it.
    Notice that the join made by Torque when selecting authors and books 
is inner join
so you won't have the authors who don't have at least a book.
(can be changed i think to left outer join if you patch torque to 
support outer joins, see mail archive)

Best regards,

Artur Z wrote:

>please help - I have a performance problem
>there are two tables: Book and Author
>I call AuthorPeer.doSelect(new Criteria()); - it returns all authors
>now i want to print all authors and their books
>on each author I must call author.getBooks();
>every time I call this method a database is queried for books for this
>and when there are 2000 authors, there will be 2000 calls to database, which
>of course takes much time
>the question is:
>how to query author table to get in return list of authors with already
>initialized books collections
>thanks a lot
>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

View raw message