Guys,
I am trying to build a query with the following criteria model … ( username = X OR email = X ) AND active = true.
My code looks like this:
var criteria = UserService.newCriteria();
var User = criteria.and(
criteria.or(
criteria.restrictions.eq( “username”, lcase( trim( arguments.username ) ) ),
criteria.restrictions.eq( “email”, lcase( trim( arguments.username ) ) )
),
criteria.restrictions.eq( “active”, true )
).list();
When this executes though, I am getting an error on line 182 of \coldbox\system\orm\hibernate\criterion\Restrictions.cfc that says “The add method was not found.”
Before I go tearing apart the Restrictions.cfc object, is my use of the criteria above correct?
Thanks!