ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ravi Sundaar" <rsund...@hotmail.com>
Subject Problem with stored procedure and resultMap or resultClass?
Date Fri, 03 Jun 2005 10:43:59 GMT
<html><div style='background-color:'><DIV class=RTE>&nbsp;am running
into a problem accessing result sets from stored procedure using ibatis datamapper. </DIV>
<P class=paragraph>My DBMS is sybase and driver is Jtds.</P>
<DIV class=RTE>Here is the sqlmap: </DIV>
<P class=paragraph>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;<BR>&lt;!DOCTYPE
sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "<SPAN class=nobr><A title="Visit
page outside Confluence" href='http://www.ibatis.com/dtd/sql-map-2.dtd">'>http://www.ibatis.com/dtd/sql-map-2.dtd"&gt;<SUP><IMG
class=rendericon height=7 alt="" src="http://opensource.atlassian.com/confluence/oss/images/icons/linkext7.gif"
width=7 align=absMiddle border=0></SUP></A></SPAN></P>
<DIV class=RTE>&lt;sqlMap namespace="PropAssessmentNameSpace"&gt; </DIV>
<P class=paragraph>&lt;!-- &lt;typeAlias alias="assessment" type="PropAssessment"/&gt;
--&gt;</P>
<DIV class=RTE>&lt;resultMap id="propAssessmentResult" class="PropAssessment"&gt;<BR>&lt;result
property="rptdPropStrAddr" column="RptdPropStrAddr" nullValue=""/&gt; <BR>&lt;/resultMap&gt;
</DIV>
<P class=paragraph>&lt;parameterMap id="PropAssessmentParamMap" class="java.util.HashMap"
&gt;<BR>&lt;parameter property="casefileId" jdbcType="VARCHAR"<BR>javaType="java.lang.String"
mode="IN"/&gt;</P>
<DIV class=RTE>&lt;/parameterMap&gt; </DIV>
<P class=paragraph>&lt;procedure id="stpRtrvPropAssessmtId" parameterMap="PropAssessmentParamMap"
resultClass="PropAssessment"&gt;
<DIV class=error>
<DIV class=error>{call stpRtrvPropAssessmt (?)}</DIV></DIV>
<DIV class=RTE><BR>&lt;/procedure&gt; </DIV>
<P class=RTE></P>
<DIV class=RTE>&lt;/sqlMap&gt; <BR>______________________________________________</DIV>
<P class=paragraph>The code snippet that invokes the procedure is below:</P>
<DIV class=RTE>HashMap paramMap = new HashMap();<BR>paramMap.put("@casefileId",
"ravi4");<BR>DataSource ds = sqlMap.getDataSource();<BR>sqlMap.setUserConnection(conn);
</DIV>
<P class=paragraph>sqlMap.queryForObject("stpRtrvPropAssessmtId", paramMap);</P>
<DIV class=RTE>When I execute the stored procedure in isql mode, with "ravi4" as the
input param, it gives me one row as the result set. </DIV>
<DIV class=RTE>____________________________________________________</DIV>
<P class=paragraph>Here is the stack trace and log from executing the procedure through
ibatis:</P>
<DIV class=RTE>DEBUG 06-02 10:53:34 </DIV>
<DIV class=error>Unknown macro:
<DIV class=error>Unknown macro: {conn-100000}</DIV></DIV>
<DIV class=RTE>Connection (ConnectionLogProxy.java:42) <BR>DEBUG 06-02 10:53:34
</DIV>
<DIV class=error>Unknown macro:
<DIV class=error>Unknown macro: {pstm-100001}</DIV></DIV>
<DIV class=RTE>PreparedStatement: (PreparedStatementLogProxy.java:48) <BR>DEBUG
06-02 10:53:34 </DIV>
<DIV class=error>Unknown macro:
<DIV class=error>Unknown macro: {pstm-100001}</DIV></DIV>
<DIV class=RTE>Parameters: <SPAN class=error>[ravi4]</SPAN> (PreparedStatementLogProxy.java:49)
<BR>DEBUG 06-02 10:53:34 Types: <SPAN class=error>[java.lang.String]</SPAN>
(PreparedStatementLogProxy.java:50) <BR>DEBUG 06-02 10:53:34 </DIV>
<DIV class=error>Unknown macro: {rset-100002}</DIV>
<DIV class=RTE>ResultSet (ResultSetLogProxy.java:41) <BR>com.ibatis.common.jdbc.exception.NestedSQLException:
<BR> The error occurred in config/PropAssessment.xml. <BR> The error occurred
while applying a parameter map. <BR> Check the PropAssessmentNameSpace.PropAssessmentParamMap.
<BR> Check the results (failed to retrieve results). <BR> Cause: java.lang.NullPointerException<BR>Caused
by: java.lang.NullPointerException<BR>at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:184)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)<BR>at

com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)<BR>at
PropAssessment.main(PropAssessment.java:266)<BR>Caused by: java.lang.NullPointerException<BR>at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<BR>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)<BR>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<BR>at
java.lang.reflect.Method.invoke(Unknown Source)<BR>at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)<BR>at
$Proxy2.close(Unknown Source)<BR>at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)<BR>at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)<BR>at

com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)<BR>
6 more </DIV>
<P class=paragraph>Caused by: <BR>java.lang.NullPointerException<BR>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)<BR>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<BR>at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<BR>at java.lang.reflect.Method.invoke(Unknown
Source)<BR>at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)<BR>at
$Proxy2.close(Unknown Source)<BR>at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)<BR>at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)<BR>at

com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)<BR>at
PropAssessment.main(PropAssessment.java:266)</P>
<DIV class=RTE>Caused by: <BR>java.lang.NullPointerException<BR>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)<BR>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<BR>at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<BR>at java.lang.reflect.Method.invoke(Unknown
Source)<BR>at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)<BR>at
$Proxy2.close(Unknown Source)<BR>at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)<BR>at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)<BR>at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)<BR>at

com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)<BR>at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)<BR>at
PropAssessment.main(PropAssessment.java:266) </DIV>
<P class=paragraph>Where am I going wrong?</P>
<DIV class=RTE>Thanks in advance for your help! </DIV>
<P class=paragraph>Ravi.</P><!-- page content ends --><!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
    rdf:about="http://atlassian01.contegix.com:10086/confluence/oss/display/IBATIS/Stored+procedure+problem+followup"
    dc:identifier="http://atlassian01.contegix.com:10086/confluence/oss/display/IBATIS/Stored+procedure+problem+followup"
    dc:title="Stored procedure problem followup"
    trackback:ping="http://atlassian01.contegix.com:10086/confluence/oss/rpc/trackback/493"/>
</rdf:RDF>
--></div></html>


Mime
View raw message