Skip to content

Bring addition

Eduardo William Karpinski Priester edited this page Oct 3, 2021 · 5 revisions
public static void main(String[] args) {

	// for one value
	List<Object[]> result1 = new HCFConnection<>(Sale.class).bringAddition(null, Arrays.asList("totalCost"));
	System.out.println(result1);

	// for two or more values
	List<Object[]> result2 = new HCFConnection<>(Sale.class).bringAddition(null, Arrays.asList("totalCost", "totalProfit"));
	for (Object[] value : result2) {
		System.out.println(value[0]);
		System.out.println(value[1]);
	}

	// with GROUPBY parameter
	List<Object[]> result = new HCFConnection<>(Sale.class).bringAddition(
		Arrays.asList(new HCFOrder(true, "country", 200, 0), new HCFOrder(true, "orderDate", null, null)),
		Arrays.asList("totalCost", "totalProfit"),
		"country", null, HCFParameter.GROUPBY, HCFOperator.NONE,
		"orderDate", null, HCFParameter.GROUPBY, HCFOperator.NONE);

	for (Object[] value : result) {
		// print country, orderDate, total cost of country and total profit country
		System.out.println(value[0] + " - " + value[1] + " - " + value[2] + " - " + value[3]);
	}

}
Clone this wiki locally