Search code examples
javaspring-dataspring-data-jdbcspring-data-r2dbc

Is there any way to work with JdbcTemplate and Query/Criteria Fluent API


R2dbcEntityTemplate has a method called select that allows me to use org.springframework.data.relational.core.query.Query to build my query statement using a Fluent API. I'm looking for a way to use this Fluent API on spring-data-jdbc in a non reactive project. I din't find any method in JdbcTemplate that I can pass a Query or CriteriaDefinition as parameter.

This is an example using R2dbcEntityTemplate:

r2dbcTemplate.select(OrderItem.class)
    .matching(query(where("order_id").is(orderId)))
    .all();

Any thoughts on how to use this with JdbcTemplate?


Solution

  • Spring Data JDBC doesn't have such an API.

    You might want to look into Querydsl or jOOQ.