Wednesday, December 8, 2010

Updating my apps database schema in the App Engine's datastore

I had read this article by Mark Ivey:

So I thought I was ready for this ... but!!

I had added a new field like this:
private int sortorder;

And got this error whatever I did:
This property is mapped to FIELD, which cannot accept null values.

So I changed my field definition to:

private Integer sortorder;

Now I could loop the records in my table and assign default values, because now null is accepted!

Puh ...


Anonymous said...

You got this error :
"This property is mapped to FIELD,"

It is because "int" :

private int sortorder;

is a primitive data type and thus cannot point to a null values,
whereas "Integer" :

private Integer sortorder;

is an Object and only objects (i.e String,Integer,Double etc..) can point to a null reference.

Hope that helps.


Fred Pallesen said...

well yes I did get that - but the problem is that in the when I go to the Dashboard in app engine and try the Datastore viewer - I will get a "Server Error -
A server error has occurred."
after an update with int's it class.