I need to call LISTAGG using the criteria api. I am calling it as shown below -
criteriaQuery.multiselect(builder.function("LISTAGG", String.class, joinedTable.get("name")).alias("source"))
This is working with h2 test database but when oracle database is used, it throws exception Exception: java.sql.SQLSyntaxErrorException: ORA-02000: missing WITHIN keyword\n\nError Code: 2000.
I tried various combinations to pass WITHIN GROUP (ORDER BY...) to builder.function("LISTAGG",....) but JPA throws exception.
Is it possible to pass WITHIN GROUP (ORDER BY joinedTable.get("name") to LISTAGG using the criteria api in eclipselink 2.7.7 ?