Grails 1.1 Hibernate查询语言(HQL) - 位置和命名参数

上面的例子中传递给查询的值是硬编码的,但是,你可以同样地使用位置参数:def results = Book.findAll("from Book as b where b.title like ?", ["The Shi%"])或者甚至使用命名参数:def results = Book.findAll("from Book as b where b.title like :search or b.author like :search", [search:"The Shi%"])