db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amine Bousta" <abou...@lxsolutions.com>
Subject RE: Re: Problem OR\\\'ing criterias
Date Wed, 05 Nov 2003 08:44:19 GMT
Hello,

I've experienced the same problem with "or" and "Criteria.LIKE". "or" was
replaced by "and" and "Like" by "=".
Then I tried to use Criterion but it was too complicated and it didn't work
as well.
So I've used a sql query and I ran an "executeQuery" instead of a
"doSelect".

When I succeeded in running the sql query I wondered what was the real use
of "Criterions".
In my opinion, using a normal "select" query is much readable and powerful
for where clauses.
With SQL you can easily manage parenthesis and all of the sql functions like
substring and else.... There is no bug with OR or IN, you can join tables
easily...
Why using Criteria that builds itself a sql query with limited options
instead of directly writting it?

I'm not blindly blaming the Criteria object but it's just a honest question
about the advantages of this.
So if anybody could light this point for me....

Thanks
Amine



-----Message d'origine-----
De : denis.griesmeyer@freenet.de [mailto:denis.griesmeyer@freenet.de]
Envoyé : vendredi 31 octobre 2003 13:37
À : Apache Torque Users List
Objet : Re: Re: Problem OR\\\'ing criterias


Thanks, any hints are highly appreciated
;-)
--- original Nachricht Ende ----


I had the exact same problem, it seems that or() adds "AND" to the
query string!

no time to check the source code yet... will let you know if something
arises

Tulsi

 --- denis.griesmeyer@freenet.de escribió:
> Hello torque-users,
>
> I have a problem with OR'ing criterias.
>
> The code is as follows:
>
> ---SNIP---
>
> Criteria crit = new Criteria();
>
> crit.or (SongsPeer.ARTIST,(Object)searchString,Criteria.LIKE);
> crit.or (SongsPeer.TITLE,(Object)searchString,Criteria.LIKE);
> crit.or (SongsPeer.ALBUM,(Object)searchString,Criteria.LIKE);
>
> ---SNIP---
>
> I would expect the query to look sth. like this:
>
> ---SNIP---
> ...
> FROM SONGS
> WHERE SONGS.ALBUM LIKE '%4%' OR SONGS.TITLE LIKE '%4%' OR
> SONGS.ARTIST LIKE '%4%'
> ---SNIP---
>
> But instead it AND's all X LIKE Y's together... :-(
>
> Maybe I missunderstood some of the basic concepts of torque...
>
> Can someone give me a hint please?
>
> Thanks in advance
> Denis
>
>
> --
> eBay - Jetzt besser einkaufen!
> Ueber 1. Mio. Angebote. Startpreise ab EUR 1,-
> <a href='http://www.freenet.de/tipp/shopping/ebay'
target='_blank'><u>http://www.freenet.de/tipp/shopping/ebay</u></a>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>

------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: <a href='http://conexion.yahoo.com.ar'
target='_blank'><u>http://conexion.yahoo.com.ar</u></a>

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




--
Nur 1x anmelden
und automatisch bis zu 1200 Produktproben und Gutscheine erhalten!
http://www.freenet.de/tipp/shopping/probenking/index.html

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