I have a submission table with columns like ID
, Name
, Code
among other properties. My requirement is to search for records based on the mentioned properties and return a paginated set.
This is the pseudocode for what I am looking for:
searchSubmission(searchFilter sf,pageIndex,noOfRecords) {
query = 'from submisssion where code=sf.code or id=sf.id order by id start_from (pageIndex*noOfRecords) limit noOfRecords'
return result();
}
There seem to be many options like CriteriaBuilder
, NamedQuery
, etc. Which is the most efficient one in this situation?