追隨Java
          簡單的事情重復做,就會產生累積效應!
          posts - 260,  comments - 338,  trackbacks - 0

          在測試hibernate時出現了如下異常:

             [Duplicate key or integrity constraint violation message from server: "Duplicate entry 'rick0@foobar.com' for key 2"]; SQL was [] for task [Hibernate operation]
           org.springframework.dao.DataIntegrityViolationException: Hibernate operation: Duplicate key or integrity constraint violation message from server: "Duplicate entry 'rick0@foobar.com' for key 2"; nested exception is java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry 'rick0@foobar.com' for key 2"
          java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry 'rick0@foobar.com' for key 2"
           at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
           at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)

            這個問題找了很久,暈了很久,終于找到了問題的所在。因我在定義數據表字段時加了not null unique,而我一次添加N條記錄時的內容一樣,主鍵是自動生成的,所以出問題了。

          posted on 2005-09-06 10:03 Harryson 閱讀(2310) 評論(0)  編輯  收藏 所屬分類: Hibernate

          <2005年9月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          常用鏈接

          留言簿(10)

          隨筆分類(319)

          AJAX

          Coffee House

          CSS

          Java

          JavaScript

          Open Source

          ProjectManagement

          友情Blog

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 新邵县| 铜鼓县| 蒙阴县| 周宁县| 读书| 江油市| 中牟县| 收藏| 临邑县| 贺州市| 黄浦区| 湘潭县| 嘉鱼县| 西华县| 积石山| 区。| 镇远县| 马边| 墨玉县| 吴堡县| 毕节市| 越西县| 鱼台县| 东山县| 新营市| 淮滨县| 黎城县| 阳高县| 加查县| 桐柏县| 宜阳县| 皋兰县| 含山县| 花垣县| 鱼台县| 都江堰市| 疏勒县| 锡林浩特市| 大方县| 年辖:市辖区| 桦川县|