Lloyd
Lloyd

Reputation: 1403

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?

Upvotes: 3

Views: 2503

Answers (2)

John Barraco
John Barraco

Reputation: 390

To convert a String type to a com.google.appengine.api.datastore.Text type I used

Text myText = new Text(myString);

Upvotes: 2

Thilo
Thilo

Reputation: 262504

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.

Upvotes: 6

Related Questions