-
Notifications
You must be signed in to change notification settings - Fork 192
Spring boot: 3.2.0, Spring data Couchbase: 5.2.0: java.lang.IllegalArgumentException: Attribute of type java.util.Collections.SingletonList cannot be stored and must be converted. #1875
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
This should work and I'll fix it. In the meantime, you might try a JsonArray instead of a List |
I tried and get the same issue: |
I haven't investigated this yet, but this is more likely the issue. How is Object supposed to be serialized? Deserialized? What constructor should be used?
|
@mikereiche this is a regression in v5. Could you make it work like it used to be in v4 ? |
The issue is that conversion.isSimpleType() considers Object to be a simple type, while the
While verifyValue (called from target.put() called from writeSimpleInternal()) does not consider it to be a simpletype.
|
I can make the serialization (save) work. But it appears that the deserialization (findById etc), did not work in v4 and won't work in v5 without other changes. The breaking change is in MappingCouchbaseConverter.java. old line 579 vs new line 616 - propertyObj.getClass() (the object) vs prop.getType() (the field on the class) deca246#diff-ed94230cdca258107738571365038a574bfe8d12f6b1fef0dea3ca4f6b19507fL579 |
@roman-sinyakov @ilangranet - are you ok with saving working, but reading (still) not working? |
with spring data 4.x, save and read were working. |
I thought I tried reading with 4.x and it didn't work. I'll look again |
I tried with spring boot 2.7.13, which brings
it worked both save and read. |
Thanks. I'll investigate on Monday. |
@ilangranet - I can't get the read to work in 4.4.x or in anything else. Since the field type is Object, it doesn't have a componentType (line 766). |
@mikereiche Hi, I've just run across to this issue on starter-data-couchbase 3.2.2 with data-couchbase 5.2.2. |
Tomorrow. https://calendar.spring.io/ |
Hi, |
Please provide details. |
it was working Spring boot: [3.2.4] Step to test
|
Hi,
I am using Spring boot: 3.2.0 with Spring data Couchbase: 5.2.0
I have an entity defined with a field of type Object (this field can be everything (String or List...)):
while trying to save it using this:
personRepository.save(new Person("1", "Alice", 25, Collections.singletonList("my issue")));
It failed on java.lang.IllegalArgumentException: Attribute of type java.util.Collections.SingletonList cannot be stored and must be converted.
it was working with previous version: Spring boot: 2.7.13, Spring data Couchbase: 4.4.13.
demo.zip
Find attached the project where it failed: to reproduce, run PersonRepositoryTest
Any suggestion?
Thank you
The text was updated successfully, but these errors were encountered: