db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Campbell, Justin" <jcampb...@profilesys.com>
Subject RE: torque-performance using cross-references
Date Mon, 20 Jan 2003 18:54:24 GMT
Marc -

You can definitely do this using Criteria without the need for a SQL
statement execution for each item in your user loop.

Check out the join section in the Torque Criteria Howto:

This is assuming you're familiar with SQL joins. If you're not, let us know

Good luck,

-----Original Message-----
From: Marc Lustig [mailto:mail@marclustig.com]
Sent: Monday, January 20, 2003 1:38 PM
To: Torque Users List
Subject: torque-performance using cross-references

I have a general question regarding performance.
In my Torque-BO-model I have a lot of cross-references /foreign-keys.
For instance:

TABLE user_item

TABLE item

Now what I need to do is getting all item's that belong to user x.

The SQL would look like this:
"SELECT item.* FROM item,user_item WHERE user_item.user_id=x AND

My current Java-code looke like this:

    Criteria c = new Criteria();
    List list = UserItemPeer.doSelect(c);
    List r = new ArrayList();
    for (int i=0;i<list.size();i++) {

As you see, this requires a single SQL-query for each entry in user_item.
Question: is it possible to this using a single Torque-method that makes a
single query the way I mentioned above?

Or is the only way to drop a JDBC Statement?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message