Skip to content
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

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

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

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 10, 2019

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

@spring-projects-issues spring-projects-issues commented Oct 15, 2019

Jens Schauder commented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants