In case there is a bug (or sql script ran by some admin) that creates many results it can kill the system. In case you need max one result, call the setMaxResult(1) function. In case you are interested if the number of results is zero, one or more than one, call the setMaxResults(2) function so you can decide if it is more than one. This is true for every place