简体   繁体   中英

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.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.

要将字符串类型转换为我使用的com.google.appengine.api.datastore.Text类型

Text myText = new Text(myString);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM