简体   繁体   中英

GUIDEWIRE : How to display the the query builder result in UI?

I am using query builder to return number of search result from the database table. Now I would like to display the result in the UI by only first three rows. How can I achieve this?

QueryAPI is lazy , when .toList(), .toTypedArray(), .toCollection(), .where(), etc occurs all resultset is retrieved ( eager ).

I recommend you to use this:

var limit = 3
var rs = Query.make(entity.XXX)...select()
rs.setPageSize(limit)
var paginatedRS = com.google.common.collect.Iterables.limit(rs,limit)

setPageSize method specifies how many rows will be fetch "by page"

limit method make a new iterator that have only the first (limit) rows

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