Description
I am trying to use Arango Java Driver (v.5.0.3). I am configuring ArangoDB in this way:
arango = new ArangoDB.Builder()
.serializer(velocyJack)
.password(password)
.host(host, port)
.maxConnections(maxConnections)
.user(userId).build();
Where velocyJack is the VelocyJack velocyJack = new VelocyJack();
with configured serializers.
It works fine when I do arango.query(), where I send my POJO to be returned. It scans for the Jackson Annotations and behaves according them.
also when I do collection.insertDocument(), the serializer woks fine.
Where I do struggle is when doing arango.getDocument(), where I also send the Class name.
When I retrieve a document using AQL specification and query(), it is transfered as per Jackson. However when I get the same document using getDocument(), it doesn't reflect the Jackson annotations. It just omits them like they wouldn't exists. So it looks that maybe for getDocument there is registered other serializer then for query()?
Here is the velocyJack configuration:
velocyJack.configure((mapper) -> {
mapper = new VPackMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
SimpleModule module = new SimpleModule();
module.addSerializer(VPackSlice.class, VPackSerializers.VPACK);
module.addSerializer(Date.class, VPackSerializers.UTIL_DATE);
module.addSerializer(java.sql.Date.class, VPackSerializers.SQL_DATE);
module.addSerializer(Timestamp.class, VPackSerializers.SQL_TIMESTAMP);
module.addSerializer(BaseDocument.class, VPackSerializers.BASE_DOCUMENT);
module.addSerializer(BaseEdgeDocument.class, VPackSerializers.BASE_EDGE_DOCUMENT);
module.addDeserializer(VPackSlice.class, VPackDeserializers.VPACK);
module.addDeserializer(Date.class, VPackDeserializers.UTIL_DATE);
module.addDeserializer(java.sql.Date.class, VPackDeserializers.SQL_DATE);
module.addDeserializer(Timestamp.class, VPackDeserializers.SQL_TIMESTAMP);
module.addDeserializer(BaseDocument.class, VPackDeserializers.BASE_DOCUMENT);
module.addDeserializer(BaseEdgeDocument.class, VPackDeserializers.BASE_EDGE_DOCUMENT);
mapper.registerModule(module);
});