jimjss 2012-12-12 17:44
浏览 1734
已采纳

Check the result mapping for the 1 property

各位大虾,小弟这两天为这个问题寝食难安。万恶的IBM。

 

websphere6.1+DB2 v9.1+ibatis2.3.4

 

配置文件如下:

sqlmapconfig.xml :

 

<sqlMapConfig>
     <transactionManager type="JDBC">
   <dataSource type="SIMPLE">
     <property name="JDBC.Driver" value="com.ibm.db2.jcc.DB2Driver"/>
     <property name="JDBC.ConnectionURL" value="url"/>
     <property name="JDBC.Username" value="username"/>
     <property name="JDBC.Password" value="pwd"/>
   </dataSource>
    </transactionManager> 
 <sqlMap resource="com/eclipselite/bank/memfis/mf/sqlmap/FundManager.xml"/>
</sqlMapConfig>

 

 

FundManager.xml:

 

<sqlMap namespace="MasterMaintenance">

<typeAlias alias="FundManager" type="com.eclipselite.bank.memfis.mf.maintenance.dom.ibatis.FundManagerDom"/>
 
 <select id="getTotalNoOfFundManagers" parameterClass="FundManager"  resultClass="int" >
      SELECT  count(1)  FROM  tables </select>
</sqlMap>

 

FundManagerDAO .java :


public class FundManagerDAO {
 public static SqlMapClient sqlMap;
 public static Map userNameMap = new HashMap();

 static{
  String internalException = null;
  try {
      Reader reader = Resources.getResourceAsReader("com/eclipselite/bank/memfis/mf/sqlmap/SqlMapConfig.xml");
      sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
      reader.close();
  } catch (IOException e) {
   e.printStackTrace(); 
   internalException = e.toString();
  }
  
  if(sqlMap == null){
   throw new RuntimeException("Something bad happened while building the sqlMapperSpain instance." , new Exception(internalException));
  }
 }
 
 public static void main(String[] args){
  try {
   System.out.println(getTotalNoOfFundManagers(null)) ;
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }
 

 public static int getTotalNoOfFundManagers(FundManagerDom dom) throws SQLException  { 
  
  Date beginDate = new Date();
  int i = 0;
  try {
   sqlMap.startTransaction();
   i = (int)MemfisGenUtility.checkInteger(sqlMap.queryForObject("getTotalNoOfFundManagers",dom));
  } catch (SQLException e) {
   e.printStackTrace();
   throw e;
  }finally{
   try {
    sqlMap.commitTransaction();
   } catch (SQLException e) {
    e.printStackTrace();
    throw e;
   }
   try {
    sqlMap.endTransaction();
   } catch (SQLException e) {
    e.printStackTrace();
    throw e;
   }
  }
  
  return i;
 }
 
 
 public List getFundManagers(FundManagerDom fmDom) throws SQLException  {
  int pageNo = fmDom.getPageNo();
  Date beginDate = new Date();
  List list;
  try{
   sqlMap.startTransaction();
    list =  this.sqlMap.queryForList("getFundManagers",fmDom, (pageNo-1)*30, 30);
   sqlMap.commitTransaction();
  }catch (SQLException e) {
   e.printStackTrace();
   throw e;
  }finally{
   try {
    sqlMap.commitTransaction();
   } catch (SQLException e) {
    e.printStackTrace();
    throw e;
   }
   try {
    sqlMap.endTransaction();
   } catch (SQLException e) {
    e.printStackTrace();
    throw e;
   }
  }
 
  return list;
 }
 
 
}

 

 

 

小弟单独DEBUG运行 木友问题 可以查出条数,但是部署在websphere6。1 之后就报如下错误:

 

 

Error Description

 com.eclipselite.bank.memfis.common.util.MemfisException : com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/eclipselite/bank/memfis/mf/sqlmap/FundManager.xml. --- The error occurred while applying a result map. --- Check the getTotalNoOfFundManagers-AutoResultMap. --- Check the result mapping for the ‘1’ property. --- Cause: com.ibm.db2.jcc.a.SqlException: DatabaseMetaData information is not known for server DB2DSN09015 by this version of JDBC driver

 

.

 

渴求各位大拿,感激不尽。

 

 
  • 写回答

1条回答 默认 最新

  • jinnianshilongnian 2012-12-12 17:50
    关注

    驱动的问题吧,你看看驱动jar包版本 位置等都改改试试

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?