Skip to content
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

Control over null values conversion during query execution #389

Closed
Magnastraw opened this issue May 5, 2021 · 6 comments
Closed

Control over null values conversion during query execution #389

Magnastraw opened this issue May 5, 2021 · 6 comments
Milestone

Comments

@Magnastraw
Copy link

Hello, can you explain please, why do not we have a control over a null values conversion, when exection queries with java driver?

util(ArangoSerializationFactory.Serializer.CUSTOM).serialize(bindVars, new ArangoSerializer.Options().serializeNullValues(true)) :

This is hardcoded behaviour

@wajda
Copy link
Contributor

wajda commented Oct 21, 2021

👍
I've got a similar issue but with deserialization.

val str = db.query("RETURN null", classOf[String]).next()
assert(str == null) // FAILS - actual result is a string "null"

That is counter intuitive and took me several hours to find a workaround like this:

val str = Option(db.query("RETURN null", classOf[Object]).next()
assert(str == null) // OK - now it returns null as expected, just needs to be casted to String

@rashtao
Copy link
Collaborator

rashtao commented Oct 22, 2021

Hi @wajda ,
this happens because deserializing to String is intended as deserializing to json string, except if the VPack being deserialized is a VPack String. This seems to me a bug, since also the case of VPack null value should be excluded.
This should be fixed by #411

@wajda
Copy link
Contributor

wajda commented Oct 22, 2021

Thank you Michele for the quick turnaround!

@rashtao
Copy link
Collaborator

rashtao commented Jan 20, 2023

@rashtao rashtao added this to the 7.0 milestone Mar 21, 2023
@rashtao
Copy link
Collaborator

rashtao commented Mar 21, 2023

Since vertion 7.0.0, keepNull behavior can be specified using Jackson API by:

  • adding annotations on related fields, or
  • registering custom serializers

see https://github.com/arangodb/arangodb-java-driver/blob/v7/docs/v7_java-reference-serialization.md.

Furthermore, to read and write raw JSON strings a new wrapper class RawJson has been introduced, see https://github.com/arangodb/arangodb-java-driver/blob/v7/docs/v7_detailed_changes.md#user-data

https://github.com/arangodb/arangodb-java-driver/releases/tag/v7.0.0-RC.4

@rashtao
Copy link
Collaborator

rashtao commented Apr 20, 2023

Closing as fixed in version 7.0.0.

keepNull behavior can be specified using Jackson API by:

  • adding annotations on related fields, or
  • registering custom serializers

see https://github.com/arangodb/docs/blob/113c2351a0153171adfc74c313454af6bb5c7f08/drivers/java-reference-serialization.md.

Furthermore, to read and write raw JSON strings a new wrapper class com.arangodb.util.RawJson has been introduced, see https://github.com/arangodb/docs/blob/113c2351a0153171adfc74c313454af6bb5c7f08/drivers/java-changes-v7.md#user-data

@rashtao rashtao closed this as completed Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants