-
Notifications
You must be signed in to change notification settings - Fork 192
Enums can't be used as method parameters in Repository #1069
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
Thanks @edudar. I'll look at this when I get a chance. |
Support enum in AbstractCouchbaseConverter.convertForWriteIfNeeded() and also call that from MappingCouchbaseConverter.getPotentiallyConvertedSimpleWrite() Closes #1069. Original pull request #1112. Co-authored-by: mikereiche <[email protected]>
* Add QueryCriteria arrayContaining. Add QueryCriteria arrayContaining which maps to n1ql array_containing. Closes #1073. Original pull request #1109. * Support enum parameters to repository queries. Support enums in AbstractCouchbaseConverter.convertForWriteIfNeeded(). Closes #1069. Original pull request #1110. Co-authored-by: mikereiche <[email protected]>
Support enum in AbstractCouchbaseConverter.convertForWriteIfNeeded() and also call that from MappingCouchbaseConverter.getPotentiallyConvertedSimpleWrite() Closes #1069. Original pull request #1112. Co-authored-by: mikereiche <[email protected]>
Support enum in AbstractCouchbaseConverter.convertForWriteIfNeeded() and also call that from MappingCouchbaseConverter.getPotentiallyConvertedSimpleWrite() Closes #1069. Original pull request: #1112. Co-authored-by: mikereiche <[email protected]>
Support enum in AbstractCouchbaseConverter.convertForWriteIfNeeded() and also call that from MappingCouchbaseConverter.getPotentiallyConvertedSimpleWrite() Closes #1069. Original pull request: #1112. Co-authored-by: mikereiche <[email protected]>
Any progress on this? :/ |
It's in 4.2.0 Also - it seems that using .toString() of the enum should work as well. |
Yeah, it's a workaround i've used too. Thanks for the contribution <3 |
I ran into the same problem, I upgraded to 4.2 but the problem is still there. I believe the reason is that I am using a List of enums, and this won't work
|
Collections and Arrays are handled by the calling code (and produce a CouchbaseList). Can you show what issue you have? Maybe it is somewhere other than the converter?
|
This is with 4.3-RC1, but 4.2.0 should have the same handling of an array of Enum I add this to AirportRepository of the unit tests.
I add this to CouchbaseRepositoryQueryIntegrationTests.findByEnum()
It produces the n1ql:
|
I will check, but I am using a collection, not an array. |
The problem is reproducible with a Collection. Fixing. |
Making a new issue to handle collection arguments. #1270 |
@mikereiche I hit the same issue when using a custom @Query("UPDATE #{#n1ql.collection} SET status = $newStatus")
Result changeStatus(@Param("newStatus") Status newStatus); gives:
I'm guessing it goes through a different code path in this scenario and the previous fix is not enough. |
hi @Pharisaeus - Thanks for bring this to our attention. I opened a new issue and tagged you in it. #1837. |
hey, looks like the query methods using collections of enum as a paremeter are still not working correctly. I created another issue #1855 |
When I have the following classes:
I can write and read entities from the DB with no issues. However, when I create a function that would search for entities using status, it fails with
Looking into the code, I see that
QueryCriteria
tries to convert Enum usingAbstractCouchbaseConverter.convertForWriteIfNeeded
. There it first looks converter up inCouchbaseCustomConversions
but can't find it as conversions know about their own and parent converters only.However, the actual conversion would be performed, if conversion found, by
conversionService
which isDefaultConversionService
and this guy actually knows how to convert to and from Enum.Adding custom implementations into
CouchbaseCustomConversions
solves this but I feel like it should not be necessary consideringDefaultConversionService
can do this already.The text was updated successfully, but these errors were encountered: