Open VietAnh14 opened 1 week ago
Have you consulted the documentation?
@Query
annotation with rowMapperRef
/rowMapperClass
attributesOther than that, we do not accept RowMapper
query method arguments.
I think you miss understand me, I'm not using @Query
annotation but using JdbcTemplate/NamedParameterJdbcTemplate
to execute some query built at runtime. This query will return the entity so it's would be nice if I can reuse the EntityRowMapper
class of spring data jdbc to map the result to entity.
Basically like this:
var entityRowMapper = //Some how get spring data jdbc row mapper for entity class
var user = namedParameterJdbcTemplate.queryForObject(
"select * from users where id = :id",
Map.of("id", "0001"),
entityRowMapper
);
I want to reuse the
EntityRowMapper
to query usingJdbcTemplate
, currently I can't find an easy way to get the mapper for an entity class and have to copy paste code fromDefaultDataAccessStrategy
to create one. It would be nice if you could support this some how.