File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes ClassicQueryTranslatorFactory & Custom Functions Doesn't work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "ClassicQueryTranslatorFactory & Custom Functions Doesn Watch "ClassicQueryTranslatorFactory & Custom Functions Doesn New topic

ClassicQueryTranslatorFactory & Custom Functions Doesn't work?

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 392
I am using hibernate 3.2.1-ga version.

I have extended the DB2Dialect and defined my own function:
registerFunction("svminus1", new NoArgSQLFunction("current time", Hibernate.TIME, false) );

It is working fine with ASTQueryTranslatorFactory

HQL: select svminus1() from Temp c where
SQL: select current time as col_0_0_ from TEMP c0_ where c0_.ID=1

But when i use ClassicQueryTranslatorFactory, it gives me errors:
org.hibernate.QueryException: aggregate function expected before ( in SELECT [select svminus1() from Temp c where]

Why am i getting this error?
I agree. Here's the link:
subject: ClassicQueryTranslatorFactory & Custom Functions Doesn't work?
It's not a secret anymore!