追隨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 閱讀(2305) 評論(0)  編輯  收藏 所屬分類: Hibernate

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

          常用鏈接

          留言簿(10)

          隨筆分類(319)

          AJAX

          Coffee House

          CSS

          Java

          JavaScript

          Open Source

          ProjectManagement

          友情Blog

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 五寨县| 八宿县| 台山市| 桓仁| 许昌市| 铜川市| 抚远县| 宜兴市| 玉山县| 山阳县| 广南县| 高要市| 平潭县| 芮城县| 拜城县| 新丰县| 永新县| 时尚| 河源市| 林西县| 白朗县| 虎林市| 广南县| 衢州市| 江津市| 太谷县| 滨州市| 吉木萨尔县| 任丘市| 定远县| 棋牌| 石首市| 辉南县| 淮北市| 利川市| 淮南市| 千阳县| 吉林省| 长顺县| 来凤县| 汝阳县|