I'm trying to do a complex query with hibernate and HQL, the query logic works in my mysql database
the mysql query is:
SELECT GetTaskStatus(t.due_date, t.completed_date) as status,
count(*) as total
FROM tasks t
GROUP BY status
the GetTaskStatus is a function registred in my db schema, it is working and i've another query which uses it in the where clause and the HQL works fine.... but i've tried many stuff and this specific query wont work
@Query("SELECT GetTaskStatus(t.dueDate, t.completedDate) as status FROM Task t GROUP BY status")
wont work...
Caused by: org.hibernate.QueryException: No data type for node: org.hibernate.hql.internal.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'GetTaskStatus' {originalText=GetTaskStatus}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'task0_.due_date' {propertyName=dueDate,dereferenceType=PRIMITIVE,getPropertyPath=dueDate,path=t.dueDate,tableAlias=task0_,className=br.com.fisgar.crm.entities.Task,classAlias=t}
| +-[ALIAS_REF] IdentNode: 'task0_.id' {alias=t, className=br.com.fisgar.crm.entities.Task, tableAlias=task0_}
| \-[IDENT] IdentNode: 'dueDate' {originalText=dueDate}
\-[DOT] DotNode: 'task0_.completed_date' {propertyName=completedDate,dereferenceType=PRIMITIVE,getPropertyPath=completedDate,path=t.completedDate,tableAlias=task0_,className=br.com.fisgar.crm.entities.Task,classAlias=t}
+-[ALIAS_REF] IdentNode: 'task0_.id' {alias=t, className=br.com.fisgar.crm.entities.Task, tableAlias=task0_}
\-[IDENT] IdentNode: 'completedDate' {originalText=completedDate}
another question in same topic, how can I return a raw column value type from a jpa repository so i dont need to create a new type only to hold the result of this query? something like
List<Map<String,Object>>