As a workaround, avoid primitives; use, for example, Integer instead. Then in
your getter, return its value as a primitive, and also check to see if it's
null, and if so, set it to whatever default you prefer.
public final class Zzz {
Integer number;
public int getNumber() {
if (this.number == null)
this.number = Integer.valueOf(0);
return (this.number.intValue());
}
datanucleus wrote:
> Once more time, DataNucleus (as per http://www.datanucleus.org) treats
> fields correctly. The problem is not in DataNucleus. It's in Google's
> plugin, where *they* define the handling of their data.
>
> When handling the equivalent situation in RDBMS (adding a new field,
> and hence a new column in a table), the field has to be defined with a
> default value, and this is then applied to the RDBMS table column, so
> any existing data has a default value. So the logical handling would
> be for them to require definition of the default value in metadata
> (annotations/XML) of the default value, and then if they retrieve a
> record without that field defined, it gains the default value.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.