I need to store a field that is usually over 500 characters. When using the String data type, App Engine fails and suggests to use the com.google.appengine.api.datastore.Text datatype in this case.
我需要存储一个通常超过500个字符的字段。使用String数据类型时,App Engine会失败并建议在这种情况下使用com.google.appengine.api.datastore.Text数据类型。
When doing so, the Android client fails with the following:
执行此操作时,Android客户端将失败并显示以下内容:
AndroidRuntime tag: Caused by: java.lang.IllegalArgumentException: expected primitive class, but got: class com.sample.sampleproj.sampleendpoint.model.Text at com.google.api.client.util.Data.parsePrimitiveValue(Data.java:4 53)
AndroidRuntime标记:引起:java.lang.IllegalArgumentException:期望的原始类,但得到:com.google.api.client.util.Data.parsePrimitiveValue上的类com.sample.sampleproj.sampleendpoint.model.Text(Data.java: 4 53)
How can string values greater than 500 characters be stored in App Engine and supported by the Cloud Endpoint?
如何将大于500个字符的字符串值存储在App Engine中并由Cloud Endpoint支持?
1 个解决方案
#1
0
There is doccumented limitation to Datastore - 500 characters for String. You can bypass it by using Text (or unindexed String, since Text is deprecated I believe). But this just covers saving/reading data from datastore.
对数据存储区有一个限制的限制 - 字符串为500个字符。您可以使用Text(或未编入索引的String,因为我不相信Text已被弃用)绕过它。但这只是从数据存储中保存/读取数据。
There is undocumented limitation of 500 chars to endpoint method single param. This mean if you send some objct to the method, which after serialization takes more space than 500 chars the method will fail.
端点方法单个参数有500个字符的无证限制。这意味着如果您向方法发送一些objct,在序列化占用的空间超过500个字符后,该方法将失败。
I did bypass it by using a servlet. See my question here
我确实通过使用servlet来绕过它。在这里看到我的问题
#1
0
There is doccumented limitation to Datastore - 500 characters for String. You can bypass it by using Text (or unindexed String, since Text is deprecated I believe). But this just covers saving/reading data from datastore.
对数据存储区有一个限制的限制 - 字符串为500个字符。您可以使用Text(或未编入索引的String,因为我不相信Text已被弃用)绕过它。但这只是从数据存储中保存/读取数据。
There is undocumented limitation of 500 chars to endpoint method single param. This mean if you send some objct to the method, which after serialization takes more space than 500 chars the method will fail.
端点方法单个参数有500个字符的无证限制。这意味着如果您向方法发送一些objct,在序列化占用的空间超过500个字符后,该方法将失败。
I did bypass it by using a servlet. See my question here
我确实通过使用servlet来绕过它。在这里看到我的问题