Skip to main content

Query Data

There are three ways to expose your application's data to clients:

  • Real-time queries (Data Server) send an initial set of data, then keep the subscription open and push every change to the client as it happens.
  • Snapshot queries (Request Server) return a single snapshot of the data each time a client asks for it.
  • Cube Query Engine serves flat, grouped and pivoted queries over JPA entities in a Spring Boot application. It is designed for grid UIs such as AG Grid's Server-Side Row Model.

Comparing the options​

Real-time queries (Data Server)Snapshot queries (Request Server)Cube Query Engine
What the client getsAn initial set of data, then a live stream of changesOne snapshot per requestOne page of flat, grouped or pivoted rows per request
How clients connectWebSocket subscription; also available over RESTRequest and reply; also available over REST, with an OpenAPI specHTTP, under /api/v1/cubes/{resource}/...
Where you define it*-dataserver.kts files or GPalDataserver classes*-reqrep.kts files or GPalRequestServer classesCubeResource declarations in a Spring Boot module
What it readsTables and views from the data modelTables and views from the data model, or custom logic in a custom Request ServerJPA entities, or a JPQL query
Grouping and pivotingNoNoYes
Live updatesYesNoNo

Which one to use​

  • Use a Data Server when the client needs to see changes as they happen, for example a live blotter.
  • Use a Request Server when the client needs the current data on demand, for example a lookup or a report.
  • Use the Cube Query Engine when your application already uses Spring and Data access APIs (JPA), and a grid needs to group, pivot or page through that data on the server. It sits alongside the Data Server and Request Server rather than replacing them. It is read-only, and because it is built on JPA it needs a SQL database.
Working with Spring?

Start with Getting Started with Spring, a step-by-step tutorial that sets up a Spring module, then Application core for how Spring is bridged into a Genesis application.