db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Subject Re: submitted patch which allows left joins, right joins and explicit inner joins
Date Fri, 06 Aug 2004 15:53:35 GMT

Scott Eade wrote:

>> I have added functionality to Torque that allows one to do left joins,
>> right joins (and explicit inner joins, in case anybody needs it). I 
>> posted

> Wow - great stuff.

First of all, I am dead pleased, that you'll be taking Thomas' outer 
join stuff on board. It'll be a huge boost to Torque's functionality.

>> Note that I did NOT change the code in generator which generates code for
>> selets with joins, e.g. BookPeer.doSelectJoinAuthor(). In my opinion, it
>> would be nice to use a left join there to get also the books without an
>> author, but I did not want to make too many changes at one time.
> For backwards compatibility we would need to leave the existing methods 
> as is.  There are I guess two ways forward, either we generate a second 
> set of methods that do left joins or we add an option to the generator 
> to determine if the existing or a left join should be used (I think the 
> latter might be the best option).

If I could make a suggestion:

I think the best thing would be to generate something like :

/** Old method */
protected static List doSelectJoin_XXX(
Criteria   criteria,
Connection connection) throws TorqueException
return (doSelectJoin_BrandViaBrand1SkippedID(criteria,connection,null));

/** New method */
protected static List doSelectJoin_XXX (
Criteria   criteria,
Connection connection,
SqlEnum    joinType) throws TorqueException

Note that this requires SqlEnum to be public! Or is there any reason why 
you would not want SqlEnum to be public?

As I am already using Thomas' patch, this was the one thing I had to 
amend in Torque's runtime code in order to be able to generate 
multi-purpose joins from the templates.

I have also changed my templates to cope with self-joins and joins with 
multiple relationships to the same table. I have done this using aliases 
for the join tables. The caller can query the alias name (if he wants to 
build Criteria using columns from the FK tables).

Unfortunately, I am not sure whether my logic would work with multiple 
column FKs (I don't use compound keys myself).



Tarlika Elisabeth Schmitz

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

View raw message