Skip to content

BaseDocument always returns empty properties #21

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

Closed
caturner81 opened this issue Jul 22, 2015 · 1 comment
Closed

BaseDocument always returns empty properties #21

caturner81 opened this issue Jul 22, 2015 · 1 comment
Labels

Comments

@caturner81
Copy link

Arango v2.6, Driver v2.5.6
So, I'm just getting started with ArangoDB so it could be that I'm missing something or it seems like your documentation on the ArangoDB website may be out of date, but the tutorial suggests the following code to fetch an entity and its properties :

DocumentEntity<BaseDocument> myDocument = null;
BaseDocument myObject2 = null;
try {
  myDocument = arangoDriver.getDocument(collectionName, "myKey", BaseDocument.class);
  myObject2 = myDocument.getEntity();
  System.out.println("Key: " + myObject2.getDocumentKey());
  System.out.println("Attribute 'a': " + myObject2.getProperties().get("a"));
  System.out.println("Attribute 'b': " + myObject2.getProperties().get("b"));
  System.out.println("Attribute 'c': " + myObject2.getProperties().get("c"));
} catch (ArangoException e) {
  System.out.println("Failed to get document. " + e.getMessage());
}

The readme for this project seems to show that you should use your own class rather than BaseDocument and count on the driver's deserialization, which seems ok, but I'd much rather have more fine grained control over my deserialization by accessing properties directly and handling nulls myself rather than getting back an object potentially chock full of null values for missing fields.

Is there some way to get BaseDocument to function as described in the code I pasted above? I've tried both like that and using the AQL and any time I use BaseDocument it returns an empty Map for properties. In any case, the tutorial should probably be updated because as a new user it's pretty frustrating when the "Java in 10 Minutes" tutorial leads to an hour of frustration because the code doesn't function as stated.

@a-brandt
Copy link
Contributor

Hello @caturner81

you found an error. I think that I killed the deserialization of the BaseDocument a while ago.

I fixed the error and released version 2.5.7 of the driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants