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.