db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Tilsted <til...@daimi.au.dk>
Subject Re: Joins to read corresponding rows
Date Fri, 15 Feb 2008 17:28:51 GMT
Thomas Vandahl wrote:
> Martin Tilsted wrote:
>> Now according to the documentation, I would expect BaseLocalepagePeer 
>> to have a protected method called doSelectJoinLocalePagepart but it 
>> don't.
>> It does not have any method starting with doSelectJoin.
>> But my BaseLocalepagepartPeer do have a doSelectJoinLocalepage.
>
> The doSelectJoin* methods exist only for the N side of a 1:N relation. 
> However you can easily use doSelectJoinLocalPage() to achieve what you 
> want.
>
> The result of the join is basically the same: A record of 
> Localepagepart together with their Localepage in each line. Only that 
> the Localepages are repeated. The magic inside the doselectJoin* 
> methods detects if the Localepage objects are identical (by comparing 
> their primary keys) and avoids to duplicate them. So the only thing 
> you need to do after the doSelectJoinLocalepage() call is to loop 
> through the result set and to select the different Localepages which 
> will be prepopulated with their associated Localepagepart objects.
But to detect copies of the local pages, I have to ask the database to 
sort the result by the primary key of my localPage.
So now I have to:
set the criteria to localPage.id (The primary key)
Allocate a new ArrayList.
Iterate over the result i got from the select, and insert all localPage 
objects which are not copies into the newly allocated ArrayList.
Sort the new ArrayList after the value, I really need them sorted in.
(Removing duplicates inline will be to ineffective, because the 
container is an ArrayList, so I need to move non duplicates to a new 
ArrayList).

This seems ineffective. What is the reason that the join don't exists 
'the other way?'
I mean in the documentation it does exists the other way.

So what is the reason the join is not there as described in the 
documentation? is it:
1: Nobody have implemented it, but it should be posible (In that case, I 
might want to try implementing it)
2: It will require a huge refactoring of Torque, due to some 
implementation details.
3: What I try to do is stupid and wrong, so I should insted do ...?

Martin
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> 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