Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Complete
-
1.9.10 (Ingalls SR10), 2.0.2 (Kay SR2), 2.0.3 (Kay SR3)
Description
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.