Hi,
I would appreciate all the help in regards to an issue I have When trying to execute a stored procedure.
Here is the details:
Hibernate Version: 3.0
JDBC Driver: com.sybase.jdbc3.jdbc.SybDataSource
Name of Database: Sybase Adaptive Server Enterprise v12.5.0.3
Mapping Documents:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.un.itsd.mgt.hibernate.mapping">
<class name="Slde" table="SLDE">
<id name="id" column="prm_key" type="java.lang.Long">
<generator class="native"/>
</id>
<property name="cnvrtAmt" column="cnvrt_amt" type="java.lang.Double" />
<property name="orguIdCode" column="orgu_id_code" type="java.lang.String" />
<property name="objtIdCode" column="objt_id_code" type="java.lang.String" />
<property name="objcIdCode" column="objc_id_code" type="java.lang.String" />
<property name="fundIdCode" column="fund_id_code" type="java.lang.String" />
</class>
<sql-query name="SldeClassification" callable="true">
<return alias="s" class="Slde">
<return-property name="fundIdCode" column="f_fund_id_code"/>
<return-property name="orguIdCode" column="f_orgu_id_code"/>
</return>
{?= call classification() }
</sql-query>
</hibernate-mapping>
The stored procedure
create proc classification
as
select fund_id_code, orgu_id_code from SLDE where objc_id_code='373'
The code
session = HibernateSessionFactory.currentSession();
Transaction tx = session.beginTransaction();
List myList = session.getNamedQuery("SldeClassification").list();
tx.commit();
HibernateSessionFactory.closeSession();
The stack trace
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
at test.sldeTest.list(sldeTest.java:22)
at test.sldeTest.main(sldeTest.java:16)
Caused by: java.sql.SQLException: S0022: Invalid column name 'prm1_0_'.
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.tds.TdsResultSet.findColumnByLabel(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.getLong(Unknown Source)
at org.hibernate.type.LongType.get(LongType.java:26)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:759)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:292)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
... 6 more
Can you please help me to figure out why I am getting "java.sql.SQLException: S0022: Invalid column name 'prm1_0_'"?
Thanks for all the help.
Regards,
Sam
|