ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tokajac <imre_to...@hotmail.com>
Subject Stored Procedures resultMap
Date Fri, 21 Nov 2008 15:53:57 GMT

Hello!


I'm trying to invoke a stored procedure which should give me back List of
entities of class UserRightsResultMap

SP.xml file: 

<resultMap id="getUserRightsResult" class="UserRightsResultMap">
    <result property="optionnm"  column="OPTIONNM" />
    <result property="allowedyn" column="ALLOWEDYN" />
</resultMap>

<parameterMap id="userRightsParams" class="map" >
  <parameter property="USR"    jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN" />
</parameterMap>

<procedure id="userRights" parameterMap="userRightsParams"
resultMap="getUserRightsResult">
  {call DATABASE.USRRGHT(?)}
</procedure>


Java DAO src: 
Map<String, String> parameterMap = new HashMap<String, String>();
parameterMap.put("USR", "myuser");
List rights = new ArrayList();
rights = sqlMap.queryForList("userRights", parameterMap);


UserRightsResultMap.java: 
package ibatis.training.resultmaps;

public class UserRightsResultMap {
    String optionnm;
    String allowedyn;
    
    public String getOptionnm(){
    	return optionnm;
    }
    public void setOptionnm(String optionnm){
    	this.optionnm = optionnm;
    }        
    public String getAllowedyn(){
    	return allowedyn;
    }
    public void setAllowedyn(String allowedyn){
    	this.allowedyn = allowedyn;
    }    
}


I got the exception: 
--- The error occurred in SP.xml.  
--- The error occurred while applying a result map.  
--- Check the SP.getUserRightsResult.  
--- Check the result mapping for the 'optionnm' property.  
--- Cause: java.sql.SQLException: An undefined column name was detected.
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
	at
ibatis.training.persistence.LineHaulSPDao.userRightsStoredProcedure(LineHaulSPDao.java:149)
	at
ibatis.training.main.LineHaulSPMainUserRights.main(LineHaulSPMainUserRights.java:12)
Caused by: java.sql.SQLException: An undefined column name was detected.
	at com.ibm.as400.access.JDError.throwSQLException(JDError.java:325)
	at com.ibm.as400.access.JDServerRow.findField(JDServerRow.java:310)
	at
com.ibm.as400.access.AS400JDBCResultSet.findColumn(AS400JDBCResultSet.java:509)
	at
com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:2619)
	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.getString(Unknown Source)
	at
com.ibatis.sqlmap.engine.type.StringTypeHandler.getResult(StringTypeHandler.java:35)
	at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResultMappingValue(BasicResultMap.java:611)
	at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:344)
	at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:381)
	at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
	at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExecutor.java:283)
	at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(ProcedureStatement.java:34)
	at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
	... 7 more



Is there anything wrong with my Java/iBatis code? 
Is there any working example for method queryForList with stored procedure?


Regards

-- 
View this message in context: http://www.nabble.com/Stored-Procedures-resultMap-tp20623886p20623886.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message