You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Thomas Fischer <fi...@seitenbau.net> on 2005/04/18 14:56:21 UTC

RE: feature request




Hi Mickey,

left joins are available in the CVS version, in the Branches HEAD and
TORQUE_3_1_BRANCH.

I am not sure whether Criteria(String generalSqlString) makes sense, for
the following reason :
Torque relies on the selected columns being in a special order to create
the object, so I would not let the user create the columns to select from
as part of the SQL query. To do that, Torque also needs to know the table
to include in the FROM clause.
The columns to select from and the table in the from clause can be obtained
from the Peer with which the select is done. But if the "Select XXX from
YYY" part is autogenerated, then one cannot handle complicated cases like
joins.

I can currently not see an acceptable way of how this could be implemented,
but I am certainly open to suggestions.  Are there any ?

    Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 18.04.2005 15:01:11:

> Hi fellows,
>
> Any chance to support Criteria(String generalSqlString), for all the
> unsupported queries?
> I need a LEFT JOIN which is unsupported and so I need to construct the
> objects by hands, instead of letting torque do it.
>
> --
>  <http://www.fetchbook.info/> www.FetchBook.Info
> Find the lowest price - Compare more then a hundred book stores in a
click.
>


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


Re: feature request

Posted by Thomas Fischer <fi...@seitenbau.net>.



It seems that you have the same problems as me.

So on the feature side of Torque, I would like to improve 1:n relations
(which is the first step towards improving m:n relations). It would be
great if Torque would support m:n relations out of the box, but this is
certainly a lot of work.

Also, I would like to be able to define views in the database schema. Views
could would come in two flavours: a sort of view which is defined in the
db, and a sort of "soft view" which can be defined using criteria (e.g. the
XXXBasePeer class could have an abstract column which has to be implemented
by criteria).

But none of this is done in one or  two days, so I couldn't grab enough
energy and time to start on it. Besides, there are also the bugs, and maybe
a new release at some point which needs preparing...

     Thomas

Thomas Vandahl <th...@tewisoft.de> schrieb am 19.04.2005 12:42:10:

> Thomas Fischer wrote:
> > This also came into my mind. The point is that one does not want to
bother
> > about village records, but one wants to fill the data objects with the
> > result of the query, and this is the difficult part, and where the
column
> > order comes in.
>
> I beg to differ. I use databases with a lot of m:n relations. Torque
> does not support this very well. So I began to use my own sets of select
> columns which sometimes are distributed over more than 10 tables. There
> is no way around BasePeer in this case (at least I didn't find one).
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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


Re: feature request

Posted by Thomas Vandahl <th...@tewisoft.de>.
Thomas Fischer wrote:
> This also came into my mind. The point is that one does not want to bother
> about village records, but one wants to fill the data objects with the
> result of the query, and this is the difficult part, and where the column
> order comes in.

I beg to differ. I use databases with a lot of m:n relations. Torque 
does not support this very well. So I began to use my own sets of select 
columns which sometimes are distributed over more than 10 tables. There 
is no way around BasePeer in this case (at least I didn't find one).

Bye, Thomas.


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


Re: feature request

Posted by Thomas Fischer <fi...@seitenbau.net>.



Thomas Vandahl <th...@tewisoft.de> schrieb am 19.04.2005 08:27:34:
> Thomas Fischer wrote:
> > I have no idea how to create such a query on the fly. Maybe something
in
> > the archives of the user list can be found. The main problem seems to
me to
> > create q query where one column value is compared to another column
value,
> > but I am not sure.
>
> There is "Criteria.add(column, object, Criteria.CUSTOM)" as in
>
> criteria.add(alias + ".IDPERSON", (Object)(alias + ".IDPERSON=" +
>                        PersonPeer.IDPERSON), Criteria.CUSTOM);
>
> It has proven to work in this case.

Good one. I did not know that.

> > Again, in my opinion the code to compose the right query for the join
from
> > a string would be quite difficult. My guess is that a "select * " will
not
> > do and will return the wrong order of columns, leading to disastrous
> > results.
>
> Well, if you are aware of the fact that you need to handle Village
> Records in this case, you can always use BasePeer.executeQuery().
>

This also came into my mind. The point is that one does not want to bother
about village records, but one wants to fill the data objects with the
result of the query, and this is the difficult part, and where the column
order comes in.

I do see Mickeys point, but I do not see an easy way to implement that
feature, athough it would certainly be helpful.

     Thomas


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


RE: feature request

Posted by Thomas Fischer <fi...@seitenbau.net>.



Good point. In fact, as there are some problems with village (it is not
supported any more, and has some problems which need fixing), the idea is
to replace village at some point. Then, the doSelectVillageRecords will
also disappear, though probably there will be some replacement. But as
there are few active commiters on Torque, it is not probable that this will
happen soon :-(

       Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 19.04.2005 15:29:36:

> I thought that the executeQuery() method is somewhat of implementation,
and
> not a real part of the interface.
> If this is the case, if one day we decide to change implementation I'm
> stuck...
>
> --
> www.FetchBook.Info
> Find the lowest price - Compare more then a hundred book stores in a
click.
>
>
> -----Original Message-----
> From: Thomas Vandahl [mailto:thomas.vandahl@tewisoft.de]
> Sent: Tuesday, April 19, 2005 8:28 AM
> To: Apache Torque Developers List
> Subject: Re: feature request
>
>
> Thomas Fischer wrote:
> > I have no idea how to create such a query on the fly. Maybe something
> > in the archives of the user list can be found. The main problem seems
> > to me to create q query where one column value is compared to another
> > column value, but I am not sure.
>
> There is "Criteria.add(column, object, Criteria.CUSTOM)" as in
>
> criteria.add(alias + ".IDPERSON", (Object)(alias + ".IDPERSON=" +
>       PersonPeer.IDPERSON), Criteria.CUSTOM);
>
> It has proven to work in this case.
>
> > Again, in my opinion the code to compose the right query for the join
> > from a string would be quite difficult. My guess is that a "select * "
> > will not do and will return the wrong order of columns, leading to
> > disastrous results.
>
> Well, if you are aware of the fact that you need to handle Village
> Records in this case, you can always use BasePeer.executeQuery().
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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


RE: feature request

Posted by Mickey Mokotov <mi...@fetchbook.info>.
I thought that the executeQuery() method is somewhat of implementation, and
not a real part of the interface.
If this is the case, if one day we decide to change implementation I'm
stuck... 

-- 
www.FetchBook.Info
Find the lowest price - Compare more then a hundred book stores in a click.


-----Original Message-----
From: Thomas Vandahl [mailto:thomas.vandahl@tewisoft.de] 
Sent: Tuesday, April 19, 2005 8:28 AM
To: Apache Torque Developers List
Subject: Re: feature request


Thomas Fischer wrote:
> I have no idea how to create such a query on the fly. Maybe something 
> in the archives of the user list can be found. The main problem seems 
> to me to create q query where one column value is compared to another 
> column value, but I am not sure.

There is "Criteria.add(column, object, Criteria.CUSTOM)" as in

criteria.add(alias + ".IDPERSON", (Object)(alias + ".IDPERSON=" +
		PersonPeer.IDPERSON), Criteria.CUSTOM);

It has proven to work in this case.

> Again, in my opinion the code to compose the right query for the join 
> from a string would be quite difficult. My guess is that a "select * " 
> will not do and will return the wrong order of columns, leading to 
> disastrous results.

Well, if you are aware of the fact that you need to handle Village 
Records in this case, you can always use BasePeer.executeQuery().

Bye, Thomas.


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



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


Re: feature request

Posted by Thomas Vandahl <th...@tewisoft.de>.
Thomas Fischer wrote:
> I have no idea how to create such a query on the fly. Maybe something in
> the archives of the user list can be found. The main problem seems to me to
> create q query where one column value is compared to another column value,
> but I am not sure.

There is "Criteria.add(column, object, Criteria.CUSTOM)" as in

criteria.add(alias + ".IDPERSON", (Object)(alias + ".IDPERSON=" +
		PersonPeer.IDPERSON), Criteria.CUSTOM);

It has proven to work in this case.

> Again, in my opinion the code to compose the right query for the join from
> a string would be quite difficult. My guess is that a "select * " will not
> do and will return the wrong order of columns, leading to disastrous
> results.

Well, if you are aware of the fact that you need to handle Village 
Records in this case, you can always use BasePeer.executeQuery().

Bye, Thomas.


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


RE: feature request

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi Mickey,

I am not quite sure this time, but your query should work out of the box if
you use the CVS version, prepend database names to the Table name in
schema.xml. Henning has done a lot for schema support there. Generate thge
docs by invokin "maven xdoc" in the root of the cvs version and see the
menu item "DB Schema support"

I have no idea how to create such a query on the fly. Maybe something in
the archives of the user list can be found. The main problem seems to me to
create q query where one column value is compared to another column value,
but I am not sure.

Again, in my opinion the code to compose the right query for the join from
a string would be quite difficult. My guess is that a "select * " will not
do and will return the wrong order of columns, leading to disastrous
results.

You might want to create a scarab issue in order that this is not
forgotten, but personally I do not see this code appear in the near future
;-(

    Thomas


"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 18.04.2005 17:28:16:

> Hi there,
>
> It's good to know that we support left joins.
> I still have a problem though - I need to query two different databases
on
> the same query:
> SELECT * FROM db1.tablex, db2.tabley WHERE tablex.a=tabley.b;
>
> I really think we should find a way to allow queries to
> not-yet-supported-selects, it's the second time I'm facing the problem,
and
> it's not a nice one to tackle...
>
> --
> www.FetchBook.Info
> Find the lowest price - Compare more then a hundred book stores in a
click.
>
>
> -----Original Message-----
> From: Thomas Fischer [mailto:fischer@seitenbau.net]
> Sent: Monday, April 18, 2005 2:56 PM
> To: Apache Torque Developers List
> Subject: RE: feature request
>
>
>
>
>
>
> Hi Mickey,
>
> left joins are available in the CVS version, in the Branches HEAD and
> TORQUE_3_1_BRANCH.
>
> I am not sure whether Criteria(String generalSqlString) makes sense, for
the
> following reason : Torque relies on the selected columns being in a
special
> order to create the object, so I would not let the user create the
columns
> to select from as part of the SQL query. To do that, Torque also needs to
> know the table to include in the FROM clause. The columns to select from
and
> the table in the from clause can be obtained from the Peer with which the
> select is done. But if the "Select XXX from YYY" part is autogenerated,
then
> one cannot handle complicated cases like joins.
>
> I can currently not see an acceptable way of how this could be
implemented,
> but I am certainly open to suggestions.  Are there any ?
>
>     Thomas
>
> "Mickey Mokotov" <mi...@fetchbook.info> schrieb am 18.04.2005 15:01:11:
>
> > Hi fellows,
> >
> > Any chance to support Criteria(String generalSqlString), for all the
> > unsupported queries? I need a LEFT JOIN which is unsupported and so I
> > need to construct the objects by hands, instead of letting torque do
> > it.
> >
> > --
> >  <http://www.fetchbook.info/> www.FetchBook.Info
> > Find the lowest price - Compare more then a hundred book stores in a
> click.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


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


RE: feature request

Posted by Mickey Mokotov <mi...@fetchbook.info>.
Hi there,

It's good to know that we support left joins.
I still have a problem though - I need to query two different databases on
the same query:
SELECT * FROM db1.tablex, db2.tabley WHERE tablex.a=tabley.b;

I really think we should find a way to allow queries to
not-yet-supported-selects, it's the second time I'm facing the problem, and
it's not a nice one to tackle...

-- 
www.FetchBook.Info
Find the lowest price - Compare more then a hundred book stores in a click.


-----Original Message-----
From: Thomas Fischer [mailto:fischer@seitenbau.net] 
Sent: Monday, April 18, 2005 2:56 PM
To: Apache Torque Developers List
Subject: RE: feature request






Hi Mickey,

left joins are available in the CVS version, in the Branches HEAD and
TORQUE_3_1_BRANCH.

I am not sure whether Criteria(String generalSqlString) makes sense, for the
following reason : Torque relies on the selected columns being in a special
order to create the object, so I would not let the user create the columns
to select from as part of the SQL query. To do that, Torque also needs to
know the table to include in the FROM clause. The columns to select from and
the table in the from clause can be obtained from the Peer with which the
select is done. But if the "Select XXX from YYY" part is autogenerated, then
one cannot handle complicated cases like joins.

I can currently not see an acceptable way of how this could be implemented,
but I am certainly open to suggestions.  Are there any ?

    Thomas

"Mickey Mokotov" <mi...@fetchbook.info> schrieb am 18.04.2005 15:01:11:

> Hi fellows,
>
> Any chance to support Criteria(String generalSqlString), for all the 
> unsupported queries? I need a LEFT JOIN which is unsupported and so I 
> need to construct the objects by hands, instead of letting torque do 
> it.
>
> --
>  <http://www.fetchbook.info/> www.FetchBook.Info
> Find the lowest price - Compare more then a hundred book stores in a
click.
>


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



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