Hi,
I use last version from repo and have the same problem. To make sure that the problem is from twig I wrote a test.
public static class HasLongKey {
@Id Long keyField;
}
@Test
public void shouldNotStorePropertyForId() throws Exception {
ObjectDatastore datastore = new AnnotationObjectDatastore();
HasLongKey hasNullKey = new HasLongKey();
datastore.store(hasNullKey);
Entity entity = DatastoreServiceFactory.getDatastoreService().get(KeyFactory.createKey("HasLongKey", 1l));
Map<String, Object> properties = entity.getProperties();
assertFalse("Property 'keyField' should not be stored", properties.keySet().contains("keyField"));
}
I did an investigation of which assume that problem occur in class FieldTranslator in method encode(...) when given property is with value null and by default index is true.
I suggest when value is null and property index is true then use translatores (row 290 in classFieldTranslator)
else if (indexed(field))
{
// only store null if it is indexed
PropertyTranslator translator = encoder(field, instance);
encoded = translator.encode(value, childPath, indexed(field));
if (encoded == null) {
PropertySets.singletonPropertySet(childPath, null, true);