Skip to content

Get first or last

Eduardo William Karpinski Priester edited this page Oct 1, 2021 · 1 revision
public static void main(String[] args) {
	// true for first and false for last
	MyEntity entity = new HCFConnection<>(MyEntity.class).getFirstOrLast(new HCFOrder(true, "id", null, 0));
	System.out.println(entity);
}

Understanding HCFOrder

private Boolean asc; // asc is used to know if the search should be ascending or descending
private String field; // field name used for search 
private Integer limit; // maximum size of results 
private Integer offset; // used to shift the first result
Clone this wiki locally