Skip to Content
1
Oct 18, 2020 at 01:52 PM

CAP Java Query Builder API - How to excute HANA functions/procedures?

214 Views

Hi,

We are using CAP Java and HANA Cloud. We can succesfully execute simple SQL statements by using the Query Builder API but we have some problems with more complex queries, for example:

  1. How can we execute a query with "count distinct". I can add a distinct() function but this is not working in the count function:
    Select.from(Apicalls_.class)
          .distinct()
          .columns(c -> func("TO_DATE", c.Date()).as("date"), 
                   c -> func("COUNT", c.UserId()).as("count"))
          .groupBy(g -> func("TO_DATE", g.Date()))
          .orderBy(o -> func("TO_DATE", o.Date()).asc())
  2. How can we execute the HANA Fuzzy search methods?
  3. How can we execute HANA functions or procedures?

I find many examples for Node.js but the examples for CAP Java are always very simple SQL statements....
Can anybody help with some examples?

Best Regards,

Chris