Java SearchAPI和Hibernate意外结束子树
我有以下实体Java SearchAPI和Hibernate意外结束子树,java,hibernate,google-search-api,Java,Hibernate,Google Search Api,我有以下实体 @Entity public class Task { private List<TaskParameter> taskParameters = Collections.emptyList(); @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "taskParameters", joinColumns = @JoinColumn( name = "
@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;
}
}
我正在使用搜索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;
}
@Transactional(readOnly=true)
公共列表GetTaskByRequestionId(字符串requisionid){
列出任务;
搜索=新搜索();
search.addFilterAll(“taskParameters”,Filter.equal(“value”,requisionid));
tasks=taskDao.search(搜索);
返回任务;
}
但有例外
[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))]
[INFO]2013-02-28 10:20:06641[btpool0-14]错误org.hibernate.hql.PARSER-:0:0:子树意外结束
[信息]2013-02-28 10:20:06642[btpool0-14]错误org.hibernate.hql.PARSER-:0:0:应为“发件人”,找到“”
[信息]org.hibernate.hql.ast.QuerySyntaxException:子树意外结束[从com.planetsystems.procnet.model.jbpm.Task中选择它(从(从)it.taskParameters中选择它(从)it.taskParameters中选择(从(u it1.value=:p1和)u it1.value不为null)]
我使用的是genericdao 1.1.0和hibernate 3.5.6-Final,我认为这里的问题可能是genericdao框架无法处理@ElementCollection案例。我以前没想过这个案子。谢谢你提出来。也许我可以在将来的版本中将其添加到框架中 同时,编写使用本机Hibernate查询的方法。您可以使用getSession()直接在DAO中获取Hibernate会话。当它工作时,请使用能够工作的HQL查询更新此线程。我可以用它来找出一种将功能构建到框架中的方法 谢谢。问得好。:)欢迎
[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))]