lqxue

          常用鏈接

          統計

          book

          tools

          最新評論

          為什么在hibernate中用list影射one-to-many時,在查詢數據時,經常有null值

           Learned a little this weekend - Bag vs List in Hibernate.  I was troubled since i really wanted to have a Java ArrayList in my object so i could index in my jsp and iterate over the list in an update form.  Using a Hibernate Set left me unable to index.  A Hibernate List left the Java ArrayList populated using the primary key - if the keys were 0,1,2,... that would have been ok.  But i only needed a few items from the database in my ArrayList and since the Hibernate List maintains the position of the object in the ArrayList equal to the position in the database the technique was leaving holes in my ArrayList of nulls.  Of course this was not what i wanted.  Now this may be explained in the documentation but after reading it twice i did not fully understand the Hibernate List.  Over the weekend i read the book Hibernate in Action and discovered the Hibernate Bag and it solved my problem.  I can use a Java ArrayList that is loaded simply by adding new objects to the beginning of the ArrayList.

          posted on 2007-04-05 16:50 lqx 閱讀(3069) 評論(1)  編輯  收藏

          評論

          # re: 為什么在hibernate中用list影射one-to-many時,在查詢數據時,經常有null值 2015-06-15 18:53 游客

          哪位大神知道的,求指教!  回復  更多評論   


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 新丰县| 昌邑市| 新和县| 宿松县| 龙岩市| 长治市| 婺源县| 聊城市| 库尔勒市| 吉林省| 乐至县| 隆子县| 冕宁县| 开江县| 贵定县| 台山市| 会同县| 永嘉县| 阳曲县| 灵台县| 莱西市| 丹阳市| 太白县| 韶山市| 密山市| 旺苍县| 额济纳旗| 泾源县| 巴彦淖尔市| 巴彦县| 丰顺县| 赞皇县| 衢州市| 子长县| 库车县| 望奎县| 浦城县| 梧州市| 高尔夫| 乌拉特前旗| 抚州市|