Hi,
I am working on using Hibernate on a legacy db system, which uses stored functions in Oracle. I tried to invoke one of these functions by using the formula attribute in property as the function simply returns a varchar so i was hoping that Hibernate would pass execution to Oracle which would just return the varchar and Hibernate would not know any better.
However, it fails when i call it giving me an "ORA-00904 - invalid identifer" error. When i run the executed query in SQLNavigator it runs ok.
And it definitely seems to be an issue with stored functions being executed as i substitued it with a dummy sum function and it ran ok.
So why does Hibernate fail on executing this? And is there a way around it?
Thanks,
John
Hibernate version: 3.2.4.sp1
Mapping documents:
<property name="linkedAls"
type="string"
formula="(select getlinkedALs( la.LICENSE ) from La_Licenses la where la.LICENSE = LICENSE)" />
<!--
<property name="linkedAls"
type="string"
formula="(select sum(la.APPLICATION_NO) from La_Licenses la where la.LICENSE = LICENSE)" />
-->
Full stack trace of any exception that occurs:
2007-06-29 09:06:18,468 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 904, SQLState: 42000
2007-06-29 09:06:18,468 ERROR [org.hibernate.util.JDBCExceptionReporter] - ORA-00904: : invalid identifier
2007-06-29 09:06:18,500 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/wis].[wis]] - Servlet.service() for servlet wis threw exception
java.sql.SQLException: ORA-00904: : invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
Name and version of the database you are using: Oracle 10g - 10.2.0.3.0
The generated SQL (show_sql=true):
select distinct licenses0_.LICENSE as LICENSE32_0_,
licenses0_.APPLICATION_NO as APPLICA59_32_0_,
(select getlinkedALs( la.LICENSE ) from La_Licenses la where la.LICENSE = licenses0_.LICENSE) as formula0_0_
from LA.LA_LICENSES licenses0_
left outer join DLWC.DLWC_ACCOUNT_ROLES relatedacc1_
on licenses0_.DLWC_ACCOUNT_ID=relatedacc1_.DLWC_ACCOUNT_ID
where (licenses0_.LICENSE like 'SOME_VAL')
and (relatedacc1_.VALID_TO is null)
and (relatedacc1_.ROLE_TYPE in ('HO' ,'HA' ,'OW'))
and relatedacc1_.ROW_EXPIRES=to_date('01013000','DDMMYYYY')
|