So I store a "User" entity in the Datastore, which is visible in the Datastore Viewer and I can see all properties that I expect, which includes a property called contacts
that contains a list of type long
(representing IDs of people in that user's contact list). This is stored using userEntity.setProperty("contacts", ids);
where ids
is a List<Long>
.
However, when I use Java on App Engine to extract this entity (without any projections, just a filter on the email address of the user I'm looking for) I receive an entity object that doesn't have the contacts property.
Is there any reason why I wouldn't be receiving the full set of properties? The code I'm using is (hopefully) relatively standard:
Query.Filter emailFilter = new Query.FilterPredicate("email", Query.FilterOperator.EQUAL, email);
Query q = new Query("User").setFilter(emailFilter);
Entity userEntity = datastoreService.prepare(q).asSingleEntity();
logger.info(userEntity.toString());
This outputs:
<Entity [User(5156288090603520)]:
lastName = Doe
updatedTs = 1414005061759
email = [email protected]
firstName = John
ownerEmail = [email protected]
>
Which is everything I see in the viewer except the contacts
property that contains the list. As such if I try userEntity.getProperty("contacts");
then I get a null object. If I run a GQL query in App Engine Console:
SELECT contacts FROM User
I also get the expected result. Any idea why my Java query doesn't return this property?