OK, let us assume that your original persistent field, and its getter
and setter methods, are something like below (using JDO):

  @Persistent
  private Integer iValue;

  public Integer getValue()
  {
    return iValue;
  }

  public void setValue(Integer value)
  {
    iValue = value;
  }


Assuming that you want to preserve your old Integer values, one thing
you could do, for a gradual change-over, is create a new Long
persistence field to something like the code snippet below, where the
new Long field has an instant effect on your code, and an eventual
effect in the datastore.

  @Persistent
  private Integer iValue;

  @Persistent
  private Long loNewValue;

  public Long getValue()
  {
    Long loResult = loNewValue;

    if ((loResult == null) && (iValue != null))
      loResult = new Long(iValue.longValue());

    return loResult;
  }

  public void setValue(Long value)
  {
    loNewValue = value;
    iValue = null;
  }


This way, your code thinks that you now have a single Long field, and
it uses old Integer values until they get overwritten with a new one.

An alternative way is to write some code to iterate through all your
instances, setting the new field with the value from the old,  but if
you have lots of instances then you may have to break this operation
up into smaller chunks.

If you don't need to preserve your old data, then forget what I have
said above since your task becomes easier.

Have fun!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to