【发布时间】:2011-01-05 04:47:29
【问题描述】:
我是 Hibernate 的新手。
我有一个Item POJO,其中包含一个由标签组成的Set<String>。标签包含在 Item 表中的另一个数据库表中,因此我进行了联接以填充 pojo。
我正在尝试从“Java Persistance with Hibernate”一书中运行一个简单的示例查询,我在其中查询from Item item where 'hello' member of item.labels。只是,由于某种原因,我得到了一个
`org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree[from /*qualified class path*/.Item item where 'hello' member of item.labels]`
可能导致此问题的原因是什么?
这是我的 POJO:
public class Item
private int uuid;
private Set<String>labels = new HashSet<String>();
@Id
public int getUuid(){
return uuid;
}
@CollectionOfElements
@JoinTable(name="labels", joinColumns=@JoinColumn(name="uuid"))
@Column(name="label")
public Set<String> getLabels(){
return labels;
}
}
【问题讨论】: