【发布时间】:2012-02-16 12:08:01
【问题描述】:
我想用一组非实体进行 JPQL 查询。这是我的表实体:
@Entity
@Table(name = "ct_table")
public class Table {
...
@CollectionOfElements(fetch = FetchType.EAGER)
@JoinTable(name = "ct_table_result", joinColumns = @JoinColumn(name = "tableId"))
@MapKey(columns = { @Column(name = "label") })
@Column(name = "value")
private Map<String, String> tableResults;
...
然后我尝试进行这样的查询
select count(*) from table where table.tableResults['somekey'].value='somevalue'
但我得到以下异常:
Cannot create element join for a collection of non-entities!
有什么建议吗??
感谢您的宝贵时间
编辑:
我使用 JPA 1 和休眠 3.3。 JBoss 5 中的默认库
【问题讨论】: