How to write a dynamic Grails crawler looking for 0 or null

What is the best way to write a dynamic Grails crawler looking for a flag equal to 0 or null?

Example

class Book {
    String title
    Date releaseDate
    String author
    Boolean paperback
    Integer isArchived
}

isArchived is NULL. Thus, the query either searches for isArchived = 0, or if it is zero, it also wants it in the results.

EDIT: At first glance this question seems like I'm not even trying and not looking at the documentation. I assure you that I studied and tried many different things.

In addition, yes, the logical flag in the database should not be zero, but at the moment it is impossible to change this table. The developer in this case relied on setting the flag value to 0 by default in the domain object. Although this worked in most cases, there are certain scenarios when a flag is set to null.

, , .

: ", , createCriteria()". , .

+4
1

where, Grails, , :

def results = Book.where {
    (isArchived == null || isArchived == 0)
}

HQL:

Book.findAll("from book b where b.isArchived IS NULL or b.isArchived = 0")
+3

All Articles