简体   繁体   English

如何使用Java在GAE数据存储中存储多行文本?

[英]How to store multiline text in GAE datastore using Java?

I need to store a multiline text field in google app engine datastore using Java. 我需要使用Java在Google App Engine数据存储区中存储多行文本字段。 I am currently using a "String" datatype. 我目前正在使用“字符串”数据类型。 I know its possible to do this using python by defining StringProperty(multiline=True). 我知道可以通过定义StringProperty(multiline = True)使用python来做到这一点。 How do I accomplish this using Java and String datatype on GAE? 如何在GAE上使用Java和String数据类型完成此操作?

thanks! 谢谢!

You should just be able to store it as a string. 您应该只能够将其存储为字符串。 Prohibiting multiline strings by default is implemented in the SDK code in Python; 默认情况下,禁止多行字符串是在Python的SDK代码中实现的; I don't believe there's any such restriction in Java. 我认为Java中没有任何此类限制。

Note, though, that String fields are indexed; 但是请注意,字符串字段已建立索引; you probably don't want your multiline string indexed, and so you should use Text instead. 您可能不希望索引多行字符串,因此应改用Text。

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

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