You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Robert Dietrick <rd...@sega.com> on 2003/05/14 00:43:54 UTC
caching
Apologies if this isn't the proper forum for this question. I wanted to
search the mailing list archives for previous discussions of this sort,
but the archives are unavailable at the moment (see broken link on
http://db.apache.org/mail.html).
I like what I've seen of Torque so far, in that it will eliminate the
need to manually synchronize schema & class modifications, its ease of
configurability and use, and the fact that it removes the need to write
SQL. However, I'd like to know if anyone has any experience with the
caching mechanism (Managers?). The docs are sparse at best and admit
that the API "should not expected to be stable", but they are also dated
2002-04-11.
Has anyone used the caching system in a production environment? Is it
buggy? Does it significantly improve performance? Any shared
experiences would be appreciated.
-rob
Does Torque Support Transactions?
Posted by John Dietz <jo...@purplebear.com>.
Does Torque support transactions such that I can make sure that if I am
inserting two records/objects that either they both get inserted, or
neither do. So can I start transactions, commit transactions, and
rollback transactions from Torque?
John Dietz
Re: Retrieving Joined Data
Posted by Scott Eade <se...@backstagetech.com.au>.
John Dietz wrote:
> Okay, I thought I could get the joined data by calling something like
> ItemPeer.doSelectJoinCategory(), but the doSelectJoin methods appear
> to be defined as Protected, so I can't call them from my other
> packages, although this appears to be the documented way to do Joins
> and get the resulting data.
Override the doSelectJoin methods you want to use in the non-Base peer
classes. They are protected because this forces you to consider
carefully which of these potentially computationally expensive methods
you want to provide access to.
Scott
--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
Re: Retrieving Joined Data
Posted by John Dietz <jo...@purplebear.com>.
Okay, I thought I could get the joined data by calling something like
ItemPeer.doSelectJoinCategory(), but the doSelectJoin methods appear to
be defined as Protected, so I can't call them from my other packages,
although this appears to be the documented way to do Joins and get the
resulting data.
Given that, I don't see at all how to actually do a Join and get the
resulting data. The Torque documentation has several examples of
creating the Join criteria without any examples of actually retrieving
the data, and I haven't found any clear answer in the listserv archive
either.
So my simple question is: How can you do a join of tables and get the
full results?
Thanks,
John Dietz
On Monday, June 30, 2003, at 11:08 PM, John Dietz wrote:
> I'm having a hard time seeing the value if the Criteria addJoin method
> given that it doesn't do quite what I expected. Let me explain by
> example:
>
> Let's say I have two tables, Category and Item, with a FK relationship
> where each Category has several Items (reference to the Category it
> Item).
> Here's what I was hoping for, if I do this:
> Criteria crit = new Criteria();
> crit.addJoin(CategoryPeer.CATEGORY_ID, ItemPeer.CATEGORY_ID);
> List categories = CategoryPeer.doSelect(crit);
>
> What I was hoping for was a List of all the Categories, prefilled with
> the Items available using Category.getItems();
> What in fact happens is that the list of Categories includes duplicate
> Categories, one for each item (like the resultset you would expect
> from a straight SQL Join), then a call to Category.getItems() run's
> another query to get all of the Items.
>
> I realize I could do a ItemPeer.doSelectJoinCategory(), which would
> get me a list of all the Items with the Category prefilled, but I
> would really like to get a list of Categories with the getItems()
> prefilled (instead of running another query to get the list for each
> Category).
>
> So if I don't get that with the addJoin(), then is there some other
> way to get that result?
>
> John Dietz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
Retrieving Joined Data
Posted by John Dietz <jo...@purplebear.com>.
I'm having a hard time seeing the value if the Criteria addJoin method
given that it doesn't do quite what I expected. Let me explain by
example:
Let's say I have two tables, Category and Item, with a FK relationship
where each Category has several Items (reference to the Category it
Item).
Here's what I was hoping for, if I do this:
Criteria crit = new Criteria();
crit.addJoin(CategoryPeer.CATEGORY_ID, ItemPeer.CATEGORY_ID);
List categories = CategoryPeer.doSelect(crit);
What I was hoping for was a List of all the Categories, prefilled with
the Items available using Category.getItems();
What in fact happens is that the list of Categories includes duplicate
Categories, one for each item (like the resultset you would expect from
a straight SQL Join), then a call to Category.getItems() run's another
query to get all of the Items.
I realize I could do a ItemPeer.doSelectJoinCategory(), which would get
me a list of all the Items with the Category prefilled, but I would
really like to get a list of Categories with the getItems() prefilled
(instead of running another query to get the list for each Category).
So if I don't get that with the addJoin(), then is there some other way
to get that result?
John Dietz