-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help registering custom Scalar Function on custom dialect
PostPosted: Thu Nov 19, 2009 12:53 pm 
Newbie

Joined: Thu Nov 19, 2009 12:24 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.