寫程序,做產品,過日子

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

          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 閱讀(215) 評論(0)  編輯  收藏 所屬分類: Java
          51La
          主站蜘蛛池模板: 绩溪县| 中西区| 哈尔滨市| 普陀区| 娱乐| 应城市| 潍坊市| 绵阳市| 富阳市| 莆田市| 武山县| 隆化县| 惠州市| 中西区| 梁山县| 宁晋县| 扎兰屯市| 郎溪县| 东乡| 甘德县| 芷江| 谢通门县| 交城县| 沧源| 北海市| 罗山县| 福鼎市| 安新县| 咸阳市| 万安县| 娱乐| 洞口县| 恭城| 乾安县| 鹤庆县| 保定市| 镇赉县| 永春县| 泰和县| 吴川市| 米脂县|