lqxue

          導航

          <2007年4月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          留言簿(5)

          隨筆分類

          文章分類

          收藏夾

          隨筆檔案

          文章檔案

          相冊

          閱讀排行榜

          評論排行榜

          常用鏈接

          統計

          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 閱讀(3068) 評論(1)  編輯  收藏

          評論

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

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


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


          網站導航:
           
          主站蜘蛛池模板: 寿阳县| 阿鲁科尔沁旗| 潜江市| 卓资县| 鄂伦春自治旗| 宣化县| 华池县| 清丰县| 衡山县| 讷河市| 陆川县| 沙雅县| 阿鲁科尔沁旗| 封丘县| 台北市| 临海市| 拉孜县| 文化| 开化县| 恩施市| 文登市| 庆元县| 东平县| 霞浦县| 南安市| 当涂县| 唐海县| 交口县| 安塞县| 遵义市| 中牟县| 苗栗县| 临沭县| 西贡区| 郴州市| 维西| 沁阳市| 天峨县| 黎城县| 南川市| 贡嘎县|