我有以下实体
@Entity
public class Task {
private List<TaskParameter> taskParameters = Collections.emptyList();
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "taskParameters", joinColumns = @JoinColumn(
name = "task_id"))
public List<TaskParameter> getTaskParameters() {
return taskParameters;
}
}
并且 TaskParameter 实体是一个嵌入定义如下:
@Embeddable
public class TaskParameter {
private String name;
private String value;
}
我正在使用 Search API 这个方法
@Transactional(readOnly = true)
public List<Task> getTaskByRequisitionId(String requisitionId) {
List<Task> tasks;
Search search = new Search();
search.addFilterAll("taskParameters",Filter.equal("value", requisitionId));
tasks = taskDao.search(search);
return tasks;
}
但得到例外
[INFO] 2013-02-28 10:20:06,641 [btpool0-14] ERROR org.hibernate.hql.PARSER - <AST>:0:0: unexpected end of subtree
[INFO] 2013-02-28 10:20:06,642 [btpool0-14] ERROR org.hibernate.hql.PARSER - <AST>:0:0: expecting "from", found '<ASTNULL>'
[INFO] org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [select _it from com.planetsystems.procnet.model.jbpm.Task _it where not exists (from _it.taskParameters _it1 where not (_it1.value = :p1 and _it1.value is not null))]
我正在使用 genericdao 1.1.0 和休眠 3.5.6-Final