Description
Mark Paluch opened DATAJDBC-309 and commented
SQL generation in JDBC and R2DBC relies heavily on pre-compiled or pre-constructed SQL statements that either do not provide sufficient flexibility or impose severe complexity on the actual generation. Furthermore, it gets more and more difficult to consider vendor-specific dialect nuances.
We should ideally provide an API that allows SQL generation on an abstract level (abstract syntax tree) to express the intention behind the statement. The AST is then visited and rendered by dialect-specific components to its final representation.
So far identified requirements:
- Support for
SELECT
,INSERT
,UPDATE
andDELETE
statements.SELECT
: Projection of fields/simple aggregate functions such asCOUNT
, support for the following clauses:WHERE
,JOIN
,WHERE
,ORDER BY
, paginationINSERT
: Field assignmentsUPDATE
: Assignments,WHERE
clauseDELETE
:WHERE
clause
Some clauses support a wide variety of operators. Our goal is to provide feature coverage for query requirements in repository support and entity mapping. It is not a goal to provide a fully sophisticated query builder API.
The AST API creates an AST object and visitor SPI. We require a follow-up ticket to implement the actual rendering considering dialect-specifics and technology specifics (e.g. native bind markers for R2DBC while JDBC uses questionmark)
Issue Links:
-
DATAJDBC-278 Create vendor specific database dialect to handle ID creation specifics of MS-SQL Server
-
DATAJDBC-29 Add pagination abstraction
-
DATAJDBC-103 Introduce SQL specification
-
DATAJDBC-340 Use infrastructure for semantic SQL generation in Spring Data JDBC
-
DATAJDBC-335 Add StatementBuilder's for INSERT, UPDATE, and DELETE
Referenced from: pull request #119
1 votes, 3 watchers