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

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包版本 位置等都改改试试

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

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看