spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
770 stars 346 forks source link

Could JdbcTemplate support using Query and Update #1514

Closed 1528110566 closed 1 year ago

1528110566 commented 1 year ago

R2dbcEntityTemplate support some operations based on org.springframework.data.relational.core.query.Query and org.springframework.data.relational.core.query.Update, like public <T> Flux<T> select(Query query, Class<T> entityClass) throws DataAccessException and public Mono<Long> update(Query query, Update update, Class<?> entityClass) throws DataAccessException.

I've noticed spring-data-relational combines spring-data-jdbc and spring-data-r2dbc, so could JdbcTemplate support operations based on Query and Update, or release Transformation Capabilities from Query&Update to sql in spring-data-r2dbc#QueryMapper?

Thanks a lot.

mp911de commented 1 year ago

JdbcTemplate is a utility to run SQL queries without knowledge of your underlying data model. Applying Query and Update requires deep inspection of your domain model and accepting constraints that not every database functionality is supported. JdbcTemplate gives you unrestricted access to run any SQL query. Therefore, there will be no support for such an approach in JdbcTemplate.