How do I write data in my Google App Engine Datastore to com.google.appengine.api.datastore.Text
I have persistent object, with a string property that often is over 500 charachters. Google App Engine says I need to save it as a com.google.appengine.api.datastore.Text.
How do I either convert a String type to a com.google开发者_JAVA技巧.appengine.api.datastore.Text type so I can use a setMethod() on the property, or otherwise get my long sting data into that persistent value?
setMethod(new Text(longStringValue));
String value = text.getValue();
If you are trying to update an existing String column to Text, then I am not sure if that is supported. You can try to change the column type from String to Text and see if it still loads (I can imagine that this might work, please let us know if it does). If not, you need to add a new column and have your application merge them appropriately.
To convert a String type to a com.google.appengine.api.datastore.Text type I used
Text myText = new Text(myString);
精彩评论