db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ludwig Magnusson" <lud...@itcatapult.com>
Subject Criteria.or not working?
Date Fri, 05 Feb 2010 10:05:20 GMT
Hi!

I have done some testing during development of a project here and it seems
that criteria.and([parameters]), criteria.add([parameters]) and
criteria.or([parameters]) all generate the same query to the database.

 

E.g these three code snippets:

Criteria criteria = new Criteria();

criteria.and("user.first_name", "John");

criteria.and("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

Criteria criteria = new Criteria();

criteria.add("user.first_name", "John");

criteria.add("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

Criteria criteria = new Criteria();

criteria.or("user.first_name", "John");

criteria.or("user.last_name", "Doe");

UserPeer.doSelect(criteria);

 

. would all generate the Sql query

SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";

 

How can this be?

/Ludwig


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message