Skip to content

Make row mappers to be a spring bean [DATAJDBC-430] #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 10, 2019 · 1 comment
Closed

Make row mappers to be a spring bean [DATAJDBC-430] #651

spring-projects-issues opened this issue Oct 10, 2019 · 1 comment
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Sergey80 opened DATAJDBC-430 and commented

Say, I want to do this:

@Named
public class PartnerFieldRowMapper implements RowMapper<PartnerField> {

 @Inject
 PartnerFieldTypeRepository partnerFieldTypeRepository;
..

 

now 

partnerFieldTypeRepository

is null.

 

and I use it like this: 

@Query(value = "select * from partner_field", rowMapperClass = PartnerFieldRowMapper.class)

 

and seems I can not inject anything in PartnerFieldRowMapper since it is not a spring bean. (?)

 

--

 

I understand that in this case I would rather do join the table and fetch what I want fro rs as is. But if speaking of flexibility.  Theoretically this mapper could call some other services to do the job. Especially it is true for older data models when combination of Repositories and mappers could hide the underlying complexity and still be able to build desirable aggregate root


Referenced from: pull request #249

@spring-projects-issues
Copy link
Author

Jens Schauder commented

We should introduce new annotation attributes rowMapperBean and resultSetExtractorBean for this.

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core support labels Dec 31, 2020
mp911de pushed a commit that referenced this issue Feb 21, 2022
Also fix a javadoc parameter name mismatch along the way.

Closes: #651
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants