使用 GWT + 从集合中选择应用程序引擎日本PA
是否可以搜索集合字段包含特定值的实体?
例如,如果我有一个名为 Item 的实体,并且它包含一个名为categories 的 Collection 字段。
public class Item {
@ManyToMany(cascade = CascadeType.ALL)
private Set<String> categories = new HashSet<String>();
}
所以我想做的是选择包含“蓝色”类别的每个项目。
我尝试了以下查询:
SELECT o FROM Item AS o WHERE o.categories = :category
SELECT o FROM Item AS o WHERE o.categoriesKeys = :category
SELECT o FROM Item AS o WHERE :category MEMBER OF o.categories
但事实并非如此不工作。
Is it possible to search for entities where a Collection field contains a specific value?
For example if I have an entity named Item and it contains a Collection field named categories.
public class Item {
@ManyToMany(cascade = CascadeType.ALL)
private Set<String> categories = new HashSet<String>();
}
So what I want to do is to select every item that contains the category "blue".
I tried the following queries:
SELECT o FROM Item AS o WHERE o.categories = :category
SELECT o FROM Item AS o WHERE o.categoriesKeys = :category
SELECT o FROM Item AS o WHERE :category MEMBER OF o.categories
But it doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是您需要的: http:// /docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html#objectstate-filtering
this is wat you need: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html#objectstate-filtering