开发者

How to filter by a boolean value in AppEngine/Java

I would like to filter my Entities by checking a boolean value:

Query stableQuery = new Query(Release.KIND).addFilter("visible", FilterOperator.EQUAL, Boolean.TRUE);

This does not开发者_如何学JAVA return any results though there are entities with visible=true.

I am very clueless and don't even know where to start tracking this down.


Instead of using Boolean.TRUE, have you tried just using true ? Would be good if you also shared how are you constructing the entity to see if "visible" property is indeed getting store as a Boolean.

Hope this helps!


Try this way:

posts = Post.all().filter("published >", False).fetch(100)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜