-
Notifications
You must be signed in to change notification settings - Fork 682
Generic class parameter not being bound to query [DATACMNS-1002] #1452
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
Comments
Michael Bragg commented Hi |
Michael Bragg commented Sugested minor change to make the dynamic projection parameter bindable. Thanks |
Oliver Drotbohm commented Thanks for the report. Just a quick acknowledgement that I see this is a problem. I guess we didn't expect anyone to bind class values to parameters really. I don't think that using I am still undecided on how to proceed here as all ways out imply some weird consequences for either side of the equation: people trying to use class as a projection input or people using it as plain parameter. Taking this back to the team to decide how to proceed |
Michael Bragg commented Thanks for the reply Oliver. Yes I've now realised that my small suggestion wouldn't be suitable. It would be possible to work around the issue, by creating dedicated repositories for the entities that extends the base entity for example (Something like this), but I'm still thinking it would be nice to have support for querying by type. e.g. Some sort of dedicated query keyword the maps to the discriminator somehow? Also are you aware or any offical documentation on how to use Sprint Data with entity hierarchies and the use of discriminator columns? |
Hi, are there any updates about this issue? |
Interestingly enough, this came up today in #2770. Working on a fix. A bit involved as it requires a few internal changes. We even thought about the option I previously ruled out (use @rafg92 – what version are you currently working with? Would you be fine with a fix for this only added in 3.1, currently scheduled for release in mid April 2023 and inclusion in Boot 3.1 (to be released mid May 2023). |
…ection parameters. This is a 2.7.x adapted fix for #1452 (the actual fix for 3.x contained in #2770). We temporarily support the use of @param on Class parameters to allow them to be be used as actual query parameters. On 3.0.x the general parameter handling gets smarter so that this mitigation can be phased out pretty quickly, but this here seems to be a simple enough fix for those who cannot upgrade to 3.0 any time soon. Fixes #1452.
Fixed via #2770 |
…ojection parameters. This is a 2.7.x adapted fix for #1452 (the actual fix for 3.x contained in #2770). We temporarily support the use of @param on Class parameters to allow them to be be used as actual query parameters. On 3.0.x the general parameter handling gets smarter so that this mitigation can be phased out pretty quickly, but this here seems to be a simple enough fix for those who cannot upgrade to 3.0 any time soon. Closes #2770. See #1452. Original pull request: #2772
Michael Bragg opened DATACMNS-1002 and commented
Im in the process of upgrading our app and I've run into an issue related to changes made here to
Parameter
. We are upgrading from Spring Data Commons from 1.11.4.RELEASE to 1.12.x / 1.13.x. We have a hierarchical entity structure. e.g.ReasonLabel extends AbstractResolutionLabel
. We have a table with a Discriminator Column for the name of the concrete type. We have the following query which previously worked:We are now getting the following error:
It appears that from this line the new
isDynamicProjectionParameter(…)
is returningtrue
, so the class parameter is not being bound, because both the parameter type and return type (T) are both equal.I appreciate this change has been here for some time now. This seems like a valid query that should be work. Many thanks
Affects: 1.13.1 (Ingalls SR1), 1.12.8 (Hopper SR8)
Reference URL: #150
Referenced from: pull request #199
The text was updated successfully, but these errors were encountered: