且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

跨Grails域类进行复杂搜索

更新时间:2022-01-18 09:36:59

我从未尝试过可搜索插件,因此可能卖空它。您***的选择可能是HQL查询或Hibernate条件生成器。我喜欢HQL来处理复杂的查询,因为它与SQL类似。对于比较使用Grails中这些技术的博客文章,请参阅
http://blog.xebia.com/2008/06/04/querying-associations-in-grails-with-hql-criteria-and-hibernatecriteriabuilder/
对于HQL参考,请参阅
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html
对于Hibernate标准,请参阅
http://docs.jboss.org/hibernate/core/3.3/reference/en/html /querycriteria.html

I've never tried the searchable plugin so may be selling it short. Your best bet is probably HQL queries or Hibernate criteria builder. I like HQL for complex queries since it's similar to SQL. For a blog post comparing the use of these technologies from Grails see http://blog.xebia.com/2008/06/04/querying-associations-in-grails-with-hql-criteria-and-hibernatecriteriabuilder/ For the HQL reference see http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html For Hibernate criteria see http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html