Hello, people.
This is my first post to this forum and i hope it will not be the last :)
I'm facing a problem trying to call a Sybase stored procedure which receives only one parameter as input and render a recordset to output.
When i try to make the call an error is thrown:
java.sql.SQLException: JZ0SC: Callable Statement: attempt to set the return status as an input parameter.
As i read in the documentation i should have modified the SP to render a status parameter for this operation, but i don't have access to the SP's code.
Can you help me within this issue?
Below i paste the mapping for the SP.
Thank you
Hibernate version: 3.1.3
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-access="property" default-lazy="false">
<class name="ro.schlund.profiseller.dao.vo.PspPromotion">
<id name="marketId" column="mediumCode" type="string"/>
<property name="designation" type="string"/>
<property name="expenditureDesignation" type="string"/>
<property name="contactPersonGender" type="string"/>
<property name="contactPersonName" type="string"/>
<property name="contactPersonPhone" type="string"/>
<property name="contactPersonPosition" type="string"/>
<property name="street" type="string"/>
<property name="expenditure" type="string"/>
<property name="place" type="string"/>
<property name="openingTimes" type="string"/>
<property name="remark" type="string"/>
<property name="conditionRentText" type="string"/>
<property name="mediumId" type="int"/>
</class>
<sql-query name="PspPromotion_SP" callable="true">
<return alias="promotion" class="ro.schlund.profiseller.dao.vo.PspPromotion">
<return-property name="marketId" column="MEDIUMCODE"/>
<return-property name="designation" column="BEZEICHNUNG"/>
<return-property name="expenditureDesignation" column="AUSGABENBEZEICHNUNG"/>
<return-property name="contactPersonGender" column="AP_ANREDE"/>
<return-property name="contactPersonName" column="AP_NAME"/>
<return-property name="contactPersonPhone" column="AP_TELEFON"/>
<return-property name="contactPersonPosition" column="AP_POSITION"/>
<return-property name="street" column="STRASSE"/>
<return-property name="expenditure" column="AUSGABE"/>
<return-property name="place" column="ORT"/>
<return-property name="openingTimes" column="OEFFNUNGSZEITEN"/>
<return-property name="remark" column="BEMERKUNG"/>
<return-property name="conditionRentText" column="STANDMIETE_TEXT"/>
<return-property name="mediumId" column="MEDIUM_ID"/>
</return>
{ ? = call fremdshop..sp_psp_promotion( :glId ) }
</sql-query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Query q = s.getNamedQuery("PspPromotion_SP");
q.setParameter("glId", glNum);
List l = q.list();
Full stack trace of any exception that occurs:
java.sql.SQLException: JZ0SC: Callable Statement: attempt to set the return status as an input parameter.
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(ErrorMessage.java:572)
at com.sybase.jdbc3.jdbc.ParamManager.setParam(ParamManager.java:380)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.setParam(SybPreparedStatement.java:1191)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.setParam(SybPreparedStatement.java:1184)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.setInt(SybPreparedStatement.java:203)
at com.mchange.v2.c3p0.impl.NewProxyCallableStatement.setInt(NewProxyCallableStatement.java:2654)
at org.hibernate.type.IntegerType.set(IntegerType.java:41)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
at org.hibernate.loader.Loader.bindNamedParameters(Loader.java:1748)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at ro.schlund.profiseller.dao.impl.MarketDAOImpl.getPromotions(MarketDAOImpl.java:65)
at ro.schlund.profiseller.market.integration.MarketSearchHandler.handleSubmittedData(MarketSearchHandler.java:70)
at de.schlund.pfixcore.workflow.app.IWrapperSimpleContainer.handleSubmittedData(IWrapperSimpleContainer.java:416)
at de.schlund.pfixcore.workflow.app.DefaultIWrapperState.getDocument(DefaultIWrapperState.java:94)
at de.schlund.pfixcore.workflow.Context.documentFromCurrentStep(Context.java:875)
at de.schlund.pfixcore.workflow.Context.documentFromFlow(Context.java:725)
at de.schlund.pfixcore.workflow.Context.handleRequest(Context.java:212)
at de.schlund.pfixxml.ContextXMLServer.getDom(ContextXMLServer.java:208)
at de.schlund.pfixxml.AbstractXMLServer.process(AbstractXMLServer.java:372)
at de.schlund.pfixxml.ServletManager.callProcess(ServletManager.java:802)
at de.schlund.pfixxml.ServletManager.doGet(ServletManager.java:365)
at de.schlund.pfixxml.ServletManager.doPost(ServletManager.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Name and version of the database you are using:
Sybase ASE 12.5
The generated SQL (show_sql=true):
located native-sql query plan in cache ({ ? = call fremdshop..sp_psp_promotion( :glId ) })
2006-04-06 16:58:39,613 [http-8080-Processor25] DEBUG org.hibernate.impl.SessionImpl [listCustomQuery():1645] - SQL query: { ? = call fremdshop..sp_psp_promotion( ? ) }
2006-04-06 16:58:39,616 [http-8080-Processor25] DEBUG org.hibernate.jdbc.AbstractBatcher [logOpenPreparedStatement():311] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-04-06 16:58:39,617 [http-8080-Processor25] DEBUG org.hibernate.SQL [log():346] - { ? = call fremdshop..sp_psp_promotion( ? ) }
2006-04-06 16:58:39,618 [http-8080-Processor25] DEBUG org.hibernate.jdbc.AbstractBatcher [getPreparedStatement():424] - preparing statement
2006-04-06 16:58:39,619 [http-8080-Processor25] DEBUG org.hibernate.loader.Loader [bindNamedParameters():1742] - bindNamedParameters() 2519794 -> glId [1]
2006-04-06 16:58:39,619 [http-8080-Processor25] DEBUG org.hibernate.type.IntegerType [nullSafeSet():80] - binding '2519794' to parameter: 1
2006-04-06 16:58:39,620 [http-8080-Processor25] DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection [handleThrowable():316]
|