我希望使用一个非实体的集合来进行JPQL查询。这是我的Table实体:
@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和Hibernate 3.3。 JBoss 5中的默认库。