## 15.3 Adding Constraints

Even if you use a Java domain model, you can still take advantage of GORM validation. Grails allows you to define constraints through a separate script that you place in the `src/java` directory. The script should be in a directory that matches the package of the corresponding domain class and its name should have a Constraints suffix. For example, if you had a domain class `org.example.Book`, then you would create the script `src/java/org/example/BookConstraints.groovy`.

The contents of the script should contain a standard GORM constraints block like so:

    constraints = {
        title(blank: false)
        author(blank: false)
    }

Once the script is in place, you'll be able to validate instances of your domain class!