db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Burschik" <Bursc...@lotto-berlin.de>
Subject AW: Simple select in Torque gets difficult???
Date Wed, 12 Nov 2003 12:41:06 GMT
If you have a static SQL statement, then using executeQuery may well be
easier. If your SQL statement may or may not contain various clauses,
depending on the user's input, for example, Criteria are much easier to use,
in my opinion. Consider the following example: a portlet is supposed to
display how often numbers have been drawn in a lottery. The user can select
whether he wishes to consider draws on Wednesday, Saturday or both, whether
he wishes to see the results for the six numbers of the main draw, or for
all seven, and whether the numbers will be sorted according to the frequency
of their occurrence or not. Using Criteria, this is pretty easy to do (or
would be, if "count(*)" worked), since you can add the criteria you need
without sweating over SQL syntax and the correct placement of parentheses,
whereas building the SQL statement manually by concatenating strings is
quite a pain, and rather error-prone.

Moreover, for simple queries, you can use Criteria without being familiar
with SQL, which might well be an advantage.

Regards

Michael Burschik


---------------------------------------------------------------------
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