Boolean values in the where clause were causing an exception because of the lack of a toQuery() method. Added this method to Boolean and a unit test for this case.