Allow to inject further conditions for Queries generated from JpaRepository method Names [DATAJPA-1646]
Julian opened DATAJPA-1646 and commented
I have a large set of entities that share common fields and multiple queries that I want to constrain on it.
As Example consider a field "deleted" which tracks if the Entity should be shown to the user or is "delteted". I would like to always get the additional Condition "deleted = false" on my Queries that are generated from the JpaRepositories Method Names.
From my research it seems like this would be doable by injecting a Custom CreateQueryLookupStrategy or modyfing the PartTree in the PartTreeJpaQuery Class. From the Current structure of the code this is not doable (without massive hacking) but it would be nice to get some kind of extension to the API to allow such modifications.
Related Stackoverflow post: https://stackoverflow.com/questions/59283251/inject-further-query-conditions-inject-automatic-entity-field-values-when-usin
Related Issue DATAJPA-1551
No further details from DATAJPA-1646
Jens Schauder commented
I'm not working on this, nor is anyone else. But it is also not clear if we want this feature and if so in what form. I therefore currently recommend against working on it
I don't think opening one aspect of the JpaQueryLookupStrategy to injection of what is currently a private inner class is a good strategy.
It introduces too many risks with not enough benefit. To top things off, the linked SO post has actually been removed for moderations reasons.
If you have a bigger vision of what a customizable query system would be, I would suggest opening a ticket to lay that out so we can analyze if that's suitable. In this current setup, this isn't something we want to take up.