如何在Objectify中按字符串过滤

时间:2015-04-16 20:52:48

标签: string google-app-engine google-cloud-datastore objectify

这是我的问题

String text = "I am here"
resutl = ofy().load().type(M.class).filter("good = "+text).first().now();

由于text包含空格,我如何将其传递给Objectify?我把它放在单引号中吗?双引号?什么?

2 个答案:

答案 0 :(得分:0)

filter()方法有两个参数:

ofy().load().type(M.class).filter("good =", text).first().now();

没有必要逃避价值。

答案 1 :(得分:0)

ofy().load().type(M.class).filter("good",text).first().now()

不需要" ="。它是默认运算符。

相关问题