db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: my experience with torque
Date Mon, 23 Aug 2004 11:06:17 GMT
Michael Moossen NO TENGO! . wrote:

>Hi, all
>  first of all, i want to give my solution for counting the number of rows with a Criteria,
a question i saw no remember where, may be in the wiki?
>  take a not null column (may be a pk column), add the condition: 
>    row is not null 
>and add a select column 
>    count(*)
>it works, but i think it will be slower than a count without the condition, depending
of the db engine.
Yes, I do something like:
        criteria.addSelectColumn("count(" + TurbineUserPeer.USER_ID + ")");
Have you added this to the wiki?

>  now, after spending several days of works integrating my app with torque, i am really
disappointed with the restrictions of torque... i mean, it is normal that any app has restrictions,
but they should be well documented. 
>  in torque's docs i have not seen any word speaking about the restriction to single column
pk tables.
As Andras said, you can indeed have multi-column primary keys - how well 
this is integrated with IDBroker I do not know.

>  the criteria how-to just speaks about a limitation for outer joins.. but it can not
handle conditions splits through several columns, like:
>  id is not null or (date1 < today and date2 > today)
Criteria.Criterion (again see message from Andras).

>  another suggestions to the developers:
> - id_broker seems to be a nice tool but it is restricted to single column pks... think
about a Invoice with pk (year, month, nr) where the nr has to be autoincremented but restarted
each month, my solution is prior to insert to select max(id) where year=.. and month=.. and
increment it, which can be generalised.
There is an enhancement in the TORQUE_3_1_HENNING branch of cvs that I 
think provides a Torque om class for accessing the IDBroker table - this 
may help with what you are trying to do.  I know Henning would like some 
feedback on the utility of his enhancements with a view to bringing them 
back into the trunk.  I personally tend to use keys independent from my 
data and so there is not often the need to construct multi-part keys.

>  Criteria has to be improved:
>- why to use two criterias for updates, just add this funcionallity to Criteria by some
set(column, value) methods and that is.
>- i think a criteria intention should be declared explicitly, via an abtract factory and/or
a enum like:
>  CriteriaFactory.getNewSelectCriteria()
>new Criteria(Criteria.SELECT)
I'd have to give some more thought the these, they would be quite 
fundamental changes to a design that was forged some time ago.

>- i am a fan of prepared statements (normal statements need formatting and escaping, it
is simplier and more secure to encapsulate a java.util.Date into a java.sql.TimeStamp than
to format it, where you have to take care of the db engine date format), torque uses PS, but
i have seen a case where not, don't remember where...
I think PS support requires some work in Torque.  I know that Thomas 
Fischer (who is working on extending the join support) has noted a few 
discrepancies with PS - a small quote:

> I am
> not sure why BasePeer.createQuery(..) processes the groupBy- and
> Having-Lists of Criteria while BasePeer.createPreparedStatement(..)
> doesn't, but I left it as it was, though I think it's a bit fishy. Also,
> the criteria.getLimit() and criteria.getOffset() are processed 
> differently
> by BasePeer.createQuery(..) and BasePeer.createPreparedStatement(..). I
> could see no reason for this

>- when you support more general pks, it should be nice when Criteria allows to specify
a join (over several fields), and other things, just given a PrimaryKey object (which should
refer to several columns, of course)
>- now i am fixing some essential things providing facades for Criteria and BasePeer and
Query, but it was not easy sence SqlEnum is package private...
We may well make SqlEnum public in the next release as it is most likely 
necessary to support and take advantage of the additional join types.  
You are welcome to contribute to the future of Torque - subscribe to 
torque-dev and post some patches.

>- i hope next releases fix some limitations, but it seems to be hard, because they affect
the core design... but at least guys, put this in the documentation as visible as posible...
>- i think it is also a good idea to keep the project up to date with java versions, to
use log4j has no sence since java 1.4 includes the logging API. and to include a jar for just
use one or two methods of StringUtils, is not worth...
Most ASF projects strive to support jdk 1.3 and forward as often in 
corporate environments people are stuck with these older versions.  By 
using commons logging you can take advantage of jdk 1.4 logging if you 
so desire.  As for StringUtils, there are a tonne of useful things in 
Commons Lang - Torque may use just a few methods, but your application 
can benefit from using these classes too.

>finally, thanx for all the effort for doing torque possible and stay working on it....
i am still using most torque's capabilities and more important i got tons of good ideas from
>best regards, 

Welcome to Torque.


Scott Eade
Backstage Technologies Pty. Ltd.

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

View raw message