非可空类型包括 int 和 boolean。我的问题是如何通过添加这些类型的新变量的架构更改来更新已经持久存在的对象。似乎我无法检索这些对象,因为它们现在有一个 null 变量,而 null 是不允许的!
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.
这是否意味着无法将这些类型的变量添加到我的架构中?
最佳答案
您可以添加新属性,但它们需要能够接受空值,这意味着两件事:
您不能添加原语。您必须使用 Integer 和 Boolean,而不是 int 和 boolean。
您的代码必须为该属性准备好为 null。
关于java - App Engine JDO 架构更改。更新新的非空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2196465/