Criteria.or not working?

"Ludwig Magnusson" <[email protected]> Fri, 5 Feb 2010 11:05:20 +0100
Newsgroups gmane.comp.jakarta.turbine.torque.user
Message-ID <00c201caa64a$ba229620$2e67c260$@com>
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