简体   繁体   English

如何将Google App Engine数据存储区中的数据写入com.google.appengine.api.datastore.Text

[英]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. 我有一个持久对象,它的字符串属性通常超过500个字符。 Google App Engine says I need to save it as a com.google.appengine.api.datastore.Text. Google App Engine说我需要将其另存为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? 如何将String类型转换为com.google.appengine.api.datastore.Text类型,以便可以在属性上使用setMethod(),或者将长字符串数据转换为该持久值?

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. 如果您尝试将现有的String列更新为Text,那么我不确定是否支持。 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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在数据库中存储“ com.google.appengine.api.datastore.Text” - How to store “com.google.appengine.api.datastore.Text” in database 如何使用com.google.appengine.api.datastore.Text - how to use com.google.appengine.api.datastore.Text 使用com.google.appengine.api.datastore.Text时如何维护格式和缩进 - How to maintain formatting and indentation when using com.google.appengine.api.datastore.Text 引起:java.lang.ClassCastException:com.google.appengine.api.datastore.Text 无法转换为 java.lang.String - Caused by: java.lang.ClassCastException: com.google.appengine.api.datastore.Text cannot be cast to java.lang.String 如何在Google App Engine _ah / api / explorer中创建com.google.appengine.api.datastore.Key对象? - How to create the com.google.appengine.api.datastore.Key object in the Google App Engine _ah/api/explorer? 如何将数据放入Google应用引擎的数据存储区? - How do I put data into the datastore of Google's app engine? Google App Engine:java.lang.NoClassDefFoundError:com / google / appengine / api / datastore / Query $ Filter - Google App Engine: java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/Query$Filter Google App Engine-java.lang.NoClassDefFoundError:com.google.appengine.api.datastore.DatastoreServiceFactory - Google App Engine - java.lang.NoClassDefFoundError: com.google.appengine.api.datastore.DatastoreServiceFactory App Engine JDO Persistent类从com.google.appengine.api.datastore.Key迁移到Long - App Engine JDO Persistent class migrate from com.google.appengine.api.datastore.Key to Long 如何将本地Google App Engine Python数据存储区复制到本地Google App Engine Java数据存储区? - How do I copy local Google App Engine Python datastore to local Google App Engine Java datastore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM