-->
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.  [ 2 posts ] 
Author Message
 Post subject: Stored Procedure with out and in
PostPosted: Mon Apr 23, 2007 5:47 pm 
Newbie

Joined: Fri Jun 03, 2005 4:23 pm
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I cannot get past this error. Can someone please help?

Hibernate version: 3.1

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="us.tx.state.dads.provider.batch.hibernate">
   <class
   name="Ne1302"
   >
   <meta attribute="sync-DAO">false</meta>
   <id
   name="id"
   type="java.lang.Long"
   column="ID_BUDGET"
   >
   </id>
   <property
   name="recordNum"
   type="string"
   column="RECORD_NUM"
   not-null="true"
   />
   <property
   name="recordType1"
   type="string"
   column="RECORD_TYPE1"
   not-null="true"
                />
   <property
   name="recordType2"
   type="string"
   column="RECORD_TYPE2"
   not-null="true"
                 />
   <property
   name="recordName"
   type="string"
   column="RECORD_NAME"
   not-null="true"
                />
   <property
   name="transNum"
   column="TRANS_NUM"
   type="java.lang.Long"
   not-null="false"
   />

   <loader query-ref="1302"/>
      

</class>   

<sql-query name="1302" callable="true">      
<return alias="n" class="Ne1302"/>
{ call PA_NE_BATCH_EXTRACT.sp_ne_batch_extract(?,:P_BATCH_NAME,:P_BATCH_TYPE,:P_PROCESS_DT) }
</sql-query>
            
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:

Query query = session.getNamedQuery(fQueryString);
query.setString("P_BATCH_NAME",fQueryString);
query.setString("P_BATCH_TYPE",fBatchType);
query.setString("P_PROCESS_DT",fProcessDt);


Full stack trace of any exception that occurs:
Code:

pr 23, 2007 4:28:41 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SP_NE_BATCH_EXTRACT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query using scroll
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query using scroll
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.scroll(Loader.java:2253)
   at org.hibernate.loader.custom.CustomLoader.scroll(CustomLoader.java:124)
   at org.hibernate.impl.SessionImpl.scrollCustomQuery(SessionImpl.java:1634)
   at org.hibernate.impl.AbstractSessionImpl.scroll(AbstractSessionImpl.java:147)
   at org.hibernate.impl.SQLQueryImpl.scroll(SQLQueryImpl.java:191)
   at org.hibernate.impl.SQLQueryImpl.scroll(SQLQueryImpl.java:199)
   at us.tx.state.dads.provider.batch.dao.NeBudgDao.getBatchResults(NeBudgDao.java:61)
   at us.tx.state.dads.provider.batch.dao.BaseBatchDao$2.doInHibernate(BaseBatchDao.java:516)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:328)
   at us.tx.state.dads.provider.batch.dao.BaseBatchDao.getProc(BaseBatchDao.java:509)
   at us.tx.state.dads.provider.batch.dao.BaseBatchDao.getBatchExtract(BaseBatchDao.java:496)
   at us.tx.state.dads.provider.batch.dao.BaseBatchDao.batchExport(BaseBatchDao.java:125)
   at us.tx.state.dads.provider.batch.dao.NeBudgDao.batchExport(NeBudgDao.java:31)
   at us.tx.state.dads.provider.BeginTest.main(BeginTest.java:78)
Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SP_NE_BATCH_EXTRACT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

   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:743)
   at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)
   at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
   at oracle.jdbc.driver.OracleStatement.doScrollExecuteCommon(OracleStatement.java:4039)
   at oracle.jdbc.driver.OraclePreparedStatement.doScrollPstmtExecuteUpdate(OraclePreparedStatement.java:10804)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3314)
   at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)
   at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)
   at org.apache.commons.dbcp.DelegatingCallableStatement.execute(DelegatingCallableStatement.java:269)
   at org.hibernate.dialect.Oracle9Dialect.getResultSet(Oracle9Dialect.java:283)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:193)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1666)
   at org.hibernate.loader.Loader.scroll(Loader.java:2218)
   ... 14 more
Exception in thread "P=718202:O=0:CT" javax.servlet.ServletException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query using scroll
   at us.tx.state.dads.provider.BeginTest.main(BeginTest.java:85)


Name and version of the database you are using:

Oracle 10g

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html
Code:
Code:
Code:


Top
 Profile  
 
 Post subject: Stored Procedure with out and in
PostPosted: Mon Apr 23, 2007 6:00 pm 
Newbie

Joined: Fri Jun 03, 2005 4:23 pm
Posts: 5
Found the problem. I had told the DBA that the first parameter had to be a ref_cursor, but I guess she did not believe me. Now it is a ref_cursor for the out parameter and everything is fine.

Thanks anyway.

Angela


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.