【发布时间】:2015-01-14 04:38:11
【问题描述】:
我的问题是不知道如何通过query dsl正确调用Oracle的原生函数。
我的sql查询是
select wm_concat(COU_NAME)
from COUNTRIES
where COU_COUNTRY_ID_PK in (1,2)
我的查询 dsl 版本是
JPAQuery query = new JPAQuery(entityManager);
List<String> test = query.from(qCountr3).where(qCountr3.id.in(1L,2L)).list(StringTemplate.create("function('wm_concat',{0})",qCountr3.name));
生成的jqpl是:
select function('wm_concat',qCountry3.name)
from Country qCountry3
where qCountry3.id in (?1)
我得到以下异常
java.lang.IllegalStateException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.MethodNode -[METHOD_CALL] MethodNode:'函数(wm_concat)' +-[METHOD_NAME] IdentNode: 'wm_concat' {originalText=wm_concat}
我正在使用带有休眠功能的 JPA 2.1
问候
【问题讨论】: