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

Override generated OQL from Repository query methods [DATAGEODE-83] #131

Closed
spring-projects-issues opened this issue Feb 14, 2018 · 0 comments
Assignees
Labels
in: query OQL Query & Indexing in: repository Repositories abstraction type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Feb 14, 2018

John Blum opened DATAGEODE-83 and commented

We have a scenario where we need to override the region-name at runtime. Based on replies from stackoverflow, we were able to override the getRegionName in a custom Gemfire Template after overriding the repositoryBaseClass.

https://stackoverflow.com/questions/45742856/sdg-override-generated-queries

While this works for the queries based on SimpleGemfireRepository, we're unable to override the region-names in the the findBy/@Query repository methods. Based on code-walkthrough, we have identified the StringBasedGemfireGemfireRepositoryQuery class - execute method where post the queryCreation, we will be able to do a string-replace based on custom logic.

Is there a possibility to have a method-hook (say customizeGeneratedQuery()) which can be called and there is no default behavior. But custom implementations can override this method to accomplish the feature. I'm looking at an option to enable bean-injection as prototype. But if there is an alternative/best-practice, that'll be interesting.

The other way, to create our own Query implementation causes a lot of code duplication and forces us to use the org.springframework package in our code as few methods have default access.


Reference URL: https://jira.spring.io/browse/SGF-713

Backported to: 2.0.5 (Kay SR5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: query OQL Query & Indexing in: repository Repositories abstraction type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants