We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
I created an example project using Oracle JSON Relational Duality View and oracle-spring-boot-starter-json-collections. https://github.com/simasch/oracle-json-relational-duality-view (Branch: etag)
The class PurchaseOrder also mapps the Metadata. But the etag and the asof values are no properly deserialized:
Is there something wrong with my setup?
The text was updated successfully, but these errors were encountered:
Hi @simasch,
Thanks for sharing this, I'm taking a look.
Sorry, something went wrong.
@simasch, this is a bug in the JDBC driver. I suggest using the following work-around until the bug is fixed:
Implement a custom deserializer for OracleJsonBinary:
import java.lang.reflect.Type; import java.sql.SQLException; import java.util.HexFormat; import jakarta.json.JsonValue; import jakarta.json.bind.JsonbException; import jakarta.json.bind.serializer.DeserializationContext; import jakarta.json.bind.serializer.JsonbDeserializer; import jakarta.json.stream.JsonParser; import oracle.sql.json.OracleJsonBinary; public class RawDeserializer implements JsonbDeserializer<String> { @Override public String deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { try { JsonValue value = parser.getValue(); OracleJsonBinary ovalue = ((java.sql.Wrapper) value).unwrap(OracleJsonBinary.class); byte[] raw = ovalue.getBytes(); return HexFormat.of().withUpperCase().formatHex(raw); } catch (SQLException e) { throw new JsonbException(e.getMessage(), e); } } }
Next, annotate the fields in your Metadata class with @JsonbTypeDeserializer, using the custom RawDeserializer class:
import jakarta.json.bind.annotation.JsonbTypeDeserializer; public class Metadata { @JsonbTypeDeserializer(RawDeserializer.class) private String asof; @JsonbTypeDeserializer(RawDeserializer.class) private String etag; // getters, setters, etc. }
Note the use of the custom deserializer is only required for raw types, like those in the metadata object.
I'll keep this issue open until Spring Cloud Oracle is able to uptake a fixed JDBC driver version 👍
Hi @anders-swanson This works. Thank you!
anders-swanson
No branches or pull requests
I created an example project using Oracle JSON Relational Duality View and oracle-spring-boot-starter-json-collections.
https://github.com/simasch/oracle-json-relational-duality-view (Branch: etag)
The class PurchaseOrder also mapps the Metadata. But the etag and the asof values are no properly deserialized:
Is there something wrong with my setup?
The text was updated successfully, but these errors were encountered: