My problem is that I don't know how to call correctly Oracle's native function through query dsl.
My sql query is
select wm_concat(COU_NAME)
from COUNTRIES
where COU_COUNTRY_ID_PK in (1,2)
My query dsl version is
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));
Generated jqpl is:
select function('wm_concat',qCountry3.name)
from Country qCountry3
where qCountry3.id in (?1)
And I get the following exception
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode -[METHOD_CALL] MethodNode: 'function (wm_concat)' +-[METHOD_NAME] IdentNode: 'wm_concat' {originalText=wm_concat}
I'm using JPA 2.1 with hibernate
Regards
The following code works for me.
I use QueryDsl version 3.7.2.
The only thing I have done is replacing StringTemplate.create() function by Expressions.stringTemplate() function.
To be complete, I have defined all following QueryDsl import at begin of my Java code.