looking into Java query approach or Kotlin based DNQ can't see how to make queries similar to 'group by' ... What is a proper approach for such queries? E.g. when I have invoices entities and I would like to group these by company name and sum of sales.
Something like this can help you achieve an emulated "GROUP BY":
entityStore.executeInTransaction(
new StoreTransactionalExecutable() {
@Override
public void execute(@NotNull final StoreTransaction txn) {
txn.getEntityTypes().forEach(type -> {
EntityIterable result = txn.getAll(type);
long count = result.count();
});
}
});
Essentially what this does is it queries all entity types and then do a count, similar to what GROUP BY does. From here you can just create a Map or something to put both the entity type and count in the map.