-
Notifications
You must be signed in to change notification settings - Fork 680
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
Expose query method metadata #3259
base: main
Are you sure you want to change the base?
Expose query method metadata #3259
Conversation
This is by design. We do not want to expose constructor arguments as However, Going forward, we do not provide SQL types or type names for |
Okay, I get it that this is an arguable idea to expose the But let's at least make the getters So we basically needlessly waste space for two more references, without getting any extra benefits. And this complicates the implementation of the child, btw. |
Well, we do not use the And, again, we of course can re-declare the references to fields that we pass to parent via |
I am aware of that. That is why we have overridden the
Unfortunately, that would not help. Changes in dialect are static. The idea is that the user must be able to dynamically provide the |
If a subclass wants to expose these, then it should introduce dedicated methods.
Encapsulation and design. Not everything a constructor receives is intended to be exposed publicly. We hide certain aspects to avoid coupling (everything that is even remotely visible is going to be used. Everything being used and then changed generates tickets that ask for a reply).
🙈
It sounds that this is the actual requirement. I wondered already whether we could come up with a mechanism to describe certain parameter aspects (e.g. in Cassandra we have That would be IMO a much cleaner approach requiring less reliance on internals. |
I'm not asking to make the accessors
I perfectly know that. The problem is that there is a balance. You can hide everything out, ad make the framework difficult to extend, and that would lead to fewer users. Or you can expose a lot, and then the framework is highly customizable and etc. but changing any api results in a breaking change, and we go down that path. I understand it. My point is - there is a balance, and I honestly do not really think that making accessors protected is that much of burden in terms of backward compatibility.
The spring-data-cassandra does exactly what we're doing, exactly that. We can, of course, add a new annotation in the spring-data-jdbc module like |
I think it is worth to make the accessors
public
(orprotected
maybe) for method andRepositoryMetadata
. The Spring Data JDBC for instance, because it cannot access themethod
field in theQueryMethod
has to re-declare it inside theJdbcQueryMethod
, so it is clearly redundant, since the method already is present in the parent.P.S: This is also would help us implemented the
YdbQueryMethod
in the Spring Data JDBC dialect for YDB database.CC: @mp911de