简体   繁体   中英

compare two objects from same domain createCriteria Grails

Hi I have the following HQL query which I am running using executeQuery():

def q = Domain.executeQuery("Select d0 from Domain d0 where d0.id = (select min(d1.id) from Domain d1 where d1.code = d0.code and d1.service = d0.service and d1.site = d0.site)");

I am trying to convert this HQL query so that the results are returned using createCriteria() instead of executeQuery() because I want to pass in pagination parameters. How would I go about doing this?

You can pass pagination parameters inside execute query also. Just pass the pagination map inside after your query string and query params (if any):
q = Domain.executeQuery("query", queryParams, paginationParams);
Please note, queryParams are optional

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM