Java – I need help parsing this statement from the GAE/Java documentation on data classes

google-app-enginejava

This section of the GAE/Java documentation is killing me. I would appreciate if someone could help me figure it out.

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

  1. What is a nullable value type?
  2. How could you load an entity without the corresponding property?
  3. What is meant by: "This won't happen if the entity was created from the same JDO class used to recreate the instance"?
  4. When you say "but can happen if the JDO class changes", how would a JDO class change?

Best Answer

  1. Any object type is nullable. Primitives (such as int or boolean) cannot be null.
  2. An older version of the class could not have had the property. And so, the data in the datastore will not have the property, and when you try to match it with the new class, it has to set the property to null.
  3. Because (2) can only happen when the class has changed.
  4. When you update your code and deploy a new version.