Greetings,
I'm trying to register a custom scalar function (one that returns a table) into a custom dialect, but so far, all i get is a 
Code:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: fpadSetoresDesc near line ...
My function is named fpadSetoresDesc and it takes an integer for parameter.
The result of it is a table with two columns and 0-* rows.
So, for instance, let's say 
Code:
select * from fpadSetoresDesc(1)
should return
Code:
cdSetor | deSetor
   1    |   asdf
   2    |   qwer
   3    |   zxcv
   4    |   abcd
   5    |   zyxw
I tried extending SQLServerDialect and registering the function as follows:
Code:
public class POSSQLServerDialect extends SQLServerDialect {
   public POSSQLServerDialect() {
      super();
      registerFunction("fpadsetoresdesc", getFpadSetoresDesc());
   }
   private SQLFunction getFpadSetoresDesc() {
      return new SQLFunctionTemplate(Hibernate.OBJECT, AppConfig.getDatabaseSchema() + ".fpadsetoresdesc(?1)");
   }
}
I tried quite a few HibernateTypes, but so far, all end up to the same exception.
Is that sort of function registering even possible?
Can anyone please lend me a light?
Thanks in advance,
Renato Back