-
Notifications
You must be signed in to change notification settings - Fork 192
Issue with ZonedDateTime Handling in Couchbase SDK #2056
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
Glad Benjamin passed on the information that I gave him. The code is intended to go in your implementation of AbstractCouchbaseConfiguration where there is indeed an additionalConverters(converters) method. If yours does not have that method, then it seems you would have an old version of spring-data-couchbase. Either upgrade or let me know what version you have so we can figure it out. |
Hi @mikereiche thanks for responses. |
Ok - your original override was correct for 4.4.2 (with the appropriate names). Sorry about that. The only change is you needed was to use CouchbaseDocument instead of JsonObject.
note to self: original CBSE ticket - https://jira.issues.couchbase.com/browse/CBSE-20261 |
copied from the CBSE: The converters should use CouchbaseDocument (instead of JsonObject). That’s what Couchbase uses internally when de/serializing. Adjust the converters as necessary to achieve the desired result. This also shows overriding additionalConverters (instead of overriding customConversions()).
Tests
|
Hi @mikereiche, Do you mean for this code is to replace the error code? (additionalConverters) ? Because I'm bit confuse with your second response, it looks similar to the code that we have tried before. |
Hi @mikereiche, We try this code and still got an error. |
This is our final code :
clean version:
|
What error? |
Hi, sorry—just to clarify, I meant to say it didn’t work, not that it threw an error. Right now, we only need to fix the registration part, since the writer and reader logic is almost correct. The issue seems to happen when trying to register the reader and converter in the CouchbaseConfiguration. |
Right. And I said don't use additionalConverters() as it was introduced in a later version. Use what you had earlier - with the new names, of course. Curiously, in the post where you say "We get this error" the code shown is NOT using additionalConverters() - but then when I ask about the error, you show code that DOES use additionalConverters(). btw - you'll only be able to tell if the converters are correct after they are successfully registered. |
We are encountering challenges with converting ZonedDateTime fields when using the Couchbase SDK. Our application relies on Java’s standard ZonedDateTime type for several temporal fields, as it retains not only the date and time, but also the associated time zone and offset. This level of precision is essential to ensure a consistent user experience, as well as for auditing and business logic purposes.
For further context :
Preserving Java’s standard ZonedDateTime type-2025052409201526 (1).pdf
Then we tried to solve it, After reviewing, the converters should use CouchbaseDocument (instead of JsonObject). That’s what Couchbase uses internally when de/serializing. Adjust the converters as necessary to achieve the desired result. This also shows overriding additionalConverters (instead of overriding customConversions()).
But still got an error :
Actually, The code above looks almost correct for both the reading and writing converters — what’s left is just how to register them in the Couchbase configuration. it’s the section in the Couchbase config where we register the reading and writing converters that have already been defined.
The text was updated successfully, but these errors were encountered: