blogjava's web log

          blogjava's web log
          ...

          ibatis jPetStore也會(huì)有個(gè)小錯(cuò)?

          下載ibatis jPetStore看了一下,的確是個(gè)學(xué)習(xí)的好例子,

          我運(yùn)行了一下,用的是mysql,運(yùn)行到把產(chǎn)品添加到購物車就報(bào)錯(cuò):

          com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject

          (SqlMapDaoTemplate.java:
          162)
          ?????
          37?more
          Caused?by:?java.sql.SQLException:?Duplicate?key?or?integrity?

          constraint?violation?message?from?server:?
          "Column?'ITEMID'?in?field?

          list?is?ambiguous
          "
          ????at?com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
          ????at?com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:
          1167)
          ????at?com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:
          1278)
          ????at?com.mysql.jdbc.Connection.execSQL(Connection.java:
          2247)
          ????at?com.mysql.jdbc.PreparedStatement.execute

          (PreparedStatement.java:
          1371)
          ????at?

          com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery

          (SqlExecutor.java:
          180)
          ????at?

          com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecut

          eQuery(GeneralStatement.java:
          205)
          ????at?

          com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQu

          eryWithCallback(GeneralStatement.java:
          173)
          ?????
          43?more



          查了半天原來是配置文件查詢的地方有的小錯(cuò)誤。


          ??<select?id="getItem"?resultClass="item"?parameterClass="string"?cacheModel="quantityCache">
          ????
          select
          //默認(rèn)里面少了個(gè)”I“。。。。。
          ???????? I?. ITEMID,
          ??????LISTPRICE,
          ??????UNITCOST,
          ??????SUPPLIER?
          AS?supplierId,
          ??????I.PRODUCTID?
          AS?"product.productId",
          ??????NAME?
          AS?"product.name",
          ??????DESCN?
          AS?"product.description",
          ??????CATEGORY?
          AS?"product.categoryId",
          ??????STATUS,
          ??????ATTR1?
          AS?attribute1,
          ??????ATTR2?
          AS?attribute2,
          ??????ATTR3?
          AS?attribute3,
          ??????ATTR4?
          AS?attribute4,
          ??????ATTR5?
          AS?attribute5,
          ??????QTY?
          AS?quantity
          ????
          from?ITEM?I,?INVENTORY?V,?PRODUCT?P
          ????
          where?P.PRODUCTID?=?I.PRODUCTID
          ??????
          and?I.ITEMID?=?V.ITEMID
          ??????
          and?I.ITEMID?=?#value#
          ??
          </select>

          posted on 2006-05-22 00:42 record java and net 閱讀(1111) 評(píng)論(4)  編輯  收藏

          評(píng)論

          # re: ibatis jPetStore也會(huì)有個(gè)小錯(cuò)? 2007-01-12 18:54 小武藏

          數(shù)據(jù)庫之間有差別,很正常  回復(fù)  更多評(píng)論   

          # re: ibatis jPetStore也會(huì)有個(gè)小錯(cuò)? 2007-03-20 16:31 jun

          還有一個(gè)問題,產(chǎn)品頁面的productid都是空的,為什么?  回復(fù)  更多評(píng)論   

          # re: ibatis jPetStore也會(huì)有個(gè)小錯(cuò)?[未登錄] 2008-07-02 21:54 蟲子

          天啊,我用postgresql的時(shí)候,也遇到你的問題,果然是這個(gè)“I”
          哈哈,你很細(xì)心,歡迎交流raofei@gmail.com  回復(fù)  更多評(píng)論   

          # re: ibatis jPetStore也會(huì)有個(gè)小錯(cuò)? 2009-02-10 17:44 zzz

          原來如此  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          常用鏈接

          留言簿(44)

          新聞檔案

          2.動(dòng)態(tài)語言

          3.工具箱

          9.文檔教程

          友情鏈接

          搜索

          最新評(píng)論

          主站蜘蛛池模板: 明溪县| 江源县| 汉源县| 林甸县| 龙州县| 界首市| 故城县| 左云县| 项城市| 军事| 浏阳市| 双柏县| 潼南县| 黄陵县| 蓬安县| 江门市| 铜陵市| 庐江县| 安新县| 贵德县| 溆浦县| 苏尼特右旗| 航空| 平南县| 凤冈县| 鞍山市| 思南县| 台州市| 色达县| 六安市| 资阳市| 道真| 淮阳县| 揭阳市| 威宁| 武强县| 阿鲁科尔沁旗| 乐亭县| 长海县| 枞阳县| 遂昌县|