-->
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: Calling custom Function
PostPosted: Tue Jan 10, 2006 2:09 pm 
Newbie

Joined: Tue Jan 10, 2006 1:54 pm
Posts: 2
Hello
I have created a custom function and registered via subclassing Oracle 9i dialect. Here is the code snippet



Code:
public CasaOracleDialect()
            {
                super();
                if (logger.isDebugEnabled())
                    {
                        logger.debug("CasaOracleDialect() - start");
                    }

                StandardSQLFunction myFunction = new StandardSQLFunction(
                        "CASA_SEC.SEC_MGR.DECRYPT_CHAR",Hibernate.STRING);
                myFunction.hasParenthesesIfNoArguments();
                myFunction.hasArguments();
                myFunction.toString();
               
                registerFunction("CASA_SEC.SEC_MGR.DECRYPT_CHAR", myFunction);

                if (logger.isDebugEnabled())
                    {
                        logger.debug("CasaOracleDialect() - end");
                    }
            }



The function takes in data of type raw and returns back a String. Here is my HQL that calls the function


Code:
select application.id ,application.sex,application.birthDate,lower(application.nameFirst),upper(application.nameLast),CASA_SEC.SEC_MGR.DECRYPT_CHAR(application.socialSecurityNumber_1) from Application application where application.nameLast=:lastName and application.nameFirst=substr(:firstName,1,3)



when I run my query I am getting this error

java.lang.IllegalStateException:
No data type for node: org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode:
'('
+-[METHOD_NAME] IdentNode: 'CASA_SEC.SEC_MGR.DECRYPT_CHAR'
{originalText=CASA_SEC.SEC_MGR.DECRYPT_CHAR}
\-[EXPR_LIST] SqlNode: 'exprList'
\-[DOT] DotNode: 'applicatio0_.SOCIAL_SECURITY_NUMBER'
{propertyName=socialSecurityNumber_1,dereferenceType=4,
propertyPath=socialSecurityNumber_1,
path=application.socialSecurityNumber_1,
tableAlias=applicatio0_,
className=com.pearson.casa.model.Application,
classAlias=application}
+-[ALIAS_REF] IdentNode:
'applicatio0_.ID'
{alias=application,
className=com.pearson.casa.model.Application,
tableAlias=applicatio0_}
\-[IDENT] IdentNode:
'socialSecurityNumber_1'
{originalText=socialSecurityNumber_1}

at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:140)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:637)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:466)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:643)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:279)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:227)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)
at com.pearson.casa.dao.DuplicateApplicationDAO.createQuery(DuplicateApplicationDAO.java:83)
at com.pearson.casa.dao.DuplicateApplicationDAO.GetDups(DuplicateApplicationDAO.java:67)
at com.pearson.casa.dao.DuplicateApplicationDAOTestCase.testGetDups(DuplicateApplicationDAOTestCase.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Any help would be greatly appreciated.


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.