Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@RequestMapping(path = "/test/{offset}", method = RequestMethod.GET)
public ResponseEntity<?> test(@PathVariable Integer offset) {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Employee> criteriaQuery = builder.createQuery(Employee.class);
Root<Employee> q = criteriaQuery.from(Employee.class);;
TypedQuery<Employee> query = entityManager.createQuery(criteriaQuery);
List<Employee> employee = query.setFirstResult(offset).setMaxResults(1000).getResultList();
int currentOffset = employee.size(); ->"{}", e));
return ResponseEntity.ok(Map.of("result", currentOffset));
// curl -X http://localhost:8080/test/0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment