寫程序,做產品,過日子

          成功其實很簡單,就是強迫自己堅持下去

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            69 Posts :: 1 Stories :: 92 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(14)

          隨筆分類(64)

          隨筆檔案(69)

          相冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          1. Hibernate can not set null value to primitive types.
          If data is null in DB, and Hibernate maps it as primitive type, An PropertyAccessException will be th rowed when.
          Our solution (Discussed with Andy):
          1) Ensure all Database fileds have default value.
          2) Wrap all primitive value in DTO. (Andy says this is not essential.)

          2. Debug Hibernate in my product

          In single way one-to-many association, when update, Hibernate always update children's id to null!
          Only when Bi-one-to-many association, Hibernate can update children correctly.
          Do not use Hibernate List. It need a index/list-index property, which bind to a DB column, but means the real index of Java List. The List often get many null items.
          Hibernate set is good. But our DTO already use ArrayList as Collection.
          Children Id is missing after updated it.
          Hibernate session.save normally call insert, session.update normally call update.
          When update Bi-one-to-many association, parent always correct. But always insert children, can not delete and update children. CAUSE: I use a modifiable field as PK, because all children's ID is missing from JSP. In this case, I should manual delete and insert children table.

          BTW, Set can not include duplicated items. However. Our DTO have no PK when it created until saved it to DB. This cause add new item fail.


          Technorati : ,

          posted on 2006-11-06 16:59 Welkin Hu 閱讀(217) 評論(0)  編輯  收藏 所屬分類: Java
          51La
          主站蜘蛛池模板: 贵德县| 永吉县| 巴彦县| 辽宁省| 安仁县| 牡丹江市| 得荣县| 司法| 灵石县| 珲春市| 新密市| 上虞市| 郴州市| 广德县| 舟山市| 虹口区| 赞皇县| 民丰县| 合川市| 德江县| 铜陵市| 海林市| 贵南县| 淄博市| 普洱| 辉县市| 白朗县| 二连浩特市| 清丰县| 白河县| 牙克石市| 溆浦县| 澄江县| 桓仁| 闻喜县| 奈曼旗| 静安区| 景德镇市| 蒙自县| 景洪市| 息烽县|