views:

225

answers:

1

The non nullable types include int and boolean. My question is how to update objects that are already persistent with a schema change adding a new variable of these types. It seems as though I cannot retrieve these objects because they now have a null variable where null is not allowed!

According to: http://code.google.com/appengine/docs/java/datastore/dataclasses.html#Object_Fields_and_Entity_Properties

If the field is not of a nullable value type, loading an entity without the corresponding property throws an exception. This won't happen if the entity was created from the same JDO class used to recreate the instance, but can happen if the JDO class changes, or if the entity was created using the low-level API instead of JDO.

Does this mean it is impossible to add a variable of these types to my schema?

+3  A: 

You can add new properties, but they need to be able to accept nulls, which means two things:

  1. You cannot add primitives. Instead of int and boolean, you have to use Integer and Boolean.

  2. Your code must be prepared for the property to be null.

Thilo