ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <ni...@wis.nl>
Subject RE: Problem with stored procedure and resultMap or resultClass?
Date Fri, 03 Jun 2005 11:06:57 GMT
Maybe because you are putting a '@casefileId' in your parameterName? Try using 'casefileId'.

Hope this helps,

Niels

________________________________________
From: Ravi Sundaar [mailto:rsundaar@hotmail.com] 
Sent: vrijdag 3 juni 2005 12:44
To: ibatis-user-java@incubator.apache.org
Cc: rsundaar@hotmail.com
Subject: Problem with stored procedure and resultMap or resultClass?

 am running into a problem accessing result sets from stored procedure using ibatis datamapper.

My DBMS is sybase and driver is Jtds.
Here is the sqlmap: 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="PropAssessmentNameSpace"> 
<!-- <typeAlias alias="assessment" type="PropAssessment"/> -->
<resultMap id="propAssessmentResult" class="PropAssessment">
<result property="rptdPropStrAddr" column="RptdPropStrAddr" nullValue=""/> 
</resultMap> 
<parameterMap id="PropAssessmentParamMap" class="java.util.HashMap" >
<parameter property="casefileId" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>
</parameterMap> 
<procedure id="stpRtrvPropAssessmtId" parameterMap="PropAssessmentParamMap" resultClass="PropAssessment">

{call stpRtrvPropAssessmt (?)}

</procedure> 
</sqlMap> 
______________________________________________
The code snippet that invokes the procedure is below:
HashMap paramMap = new HashMap();
paramMap.put("@casefileId", "ravi4");
DataSource ds = sqlMap.getDataSource();
sqlMap.setUserConnection(conn); 
sqlMap.queryForObject("stpRtrvPropAssessmtId", paramMap);
When I execute the stored procedure in isql mode, with "ravi4" as the input param, it gives
me one row as the result set. 
____________________________________________________
Here is the stack trace and log from executing the procedure through ibatis:
DEBUG 06-02 10:53:34 
Unknown macro: 
Unknown macro: {conn-100000}
Connection (ConnectionLogProxy.java:42) 
DEBUG 06-02 10:53:34 
Unknown macro: 
Unknown macro: {pstm-100001}
PreparedStatement: (PreparedStatementLogProxy.java:48) 
DEBUG 06-02 10:53:34 
Unknown macro: 
Unknown macro: {pstm-100001}
Parameters: [ravi4] (PreparedStatementLogProxy.java:49) 
DEBUG 06-02 10:53:34 Types: [java.lang.String] (PreparedStatementLogProxy.java:50) 
DEBUG 06-02 10:53:34 
Unknown macro: {rset-100002}
ResultSet (ResultSetLogProxy.java:41) 
com.ibatis.common.jdbc.exception.NestedSQLException: 
- The error occurred in config/PropAssessment.xml. 
- The error occurred while applying a parameter map. 
- Check the PropAssessmentNameSpace.PropAssessmentParamMap. 
- Check the results (failed to retrieve results). 
- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:184)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)
at PropAssessment.main(PropAssessment.java:266)
Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
at $Proxy2.close(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)
at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)
... 6 more 
Caused by: 
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
at $Proxy2.close(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)
at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)
at PropAssessment.main(PropAssessment.java:266)
Caused by: 
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
at $Proxy2.close(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.java:392)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:298)
at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:169)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:97)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:69)
at PropAssessment.main(PropAssessment.java:266) 
Where am I going wrong?
Thanks in advance for your help! 
Ravi.


Mime
View raw message