afunms

          My Software,My Dream—Forge a more perfect NMS product.

          perfect DAO solution

          DAO design was revised repeatedly recent days,I am glad of  getting a perfect DAO solution
          finally.
            The sticking point in DAO design is where a DB connection is opened and when
          to close it. Sometimes,one action executes only one DAO method,the connection
          should be closed immediately follow the method. Sometimes, However, one action
          may contain many DAOs or a series of methods in a DAO, (in other words, called transaction).
          A same connection is used in DAOs,so closing connection after method execution is incorrect.
            Therefore,I wrote two DAO's constructors for above two scenarios.For the first scenario,
          opening a connection inside DAO,and close it at once after a method is invoked.For the second
          scenario,a connection is created outside DAO, when instantiating a new DAO class,the connection
          is passed from outside.We cope with this case (a transaction) in a service,the service invokes more
          than one DAOs.DB connection is opened when service starting,and closed at the end of service.

          posted on 2008-01-09 10:21 afunms 閱讀(165) 評(píng)論(0)  編輯  收藏


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          My Links

          News

          留言簿(18)

          隨筆檔案

          相冊(cè)

          搜索

          最新評(píng)論

          閱讀排行榜

          主站蜘蛛池模板: 咸丰县| 关岭| 福建省| 盐源县| 应城市| 德令哈市| 益阳市| 淮滨县| 岢岚县| 恩平市| 尖扎县| 五家渠市| 宜丰县| 晋江市| 杭锦后旗| 嘉兴市| 肇源县| 葫芦岛市| 横峰县| 平定县| 四子王旗| 五河县| 汽车| 丹凤县| 郸城县| 土默特左旗| 泊头市| 广汉市| 南开区| 上蔡县| 通州区| 南安市| 清新县| 托里县| 吉安市| 湖口县| 沅陵县| 晋宁县| 屏山县| 筠连县| 日土县|