kukooBlog

          look to the master, follow the master, walk with the master, see through the master, become the master.

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            213 隨筆 :: 0 文章 :: 285 評論 :: 0 Trackbacks

          .... At the other end of a typical web application is the persistence layer. .... There are several open source object-to-relational mapping (ORM) frameworks that solve much of this problem. In particular, the Hibernate framework allows object-to-relational persistence and query service for Java. Hibernate has a medium learning curve for Java developers who are already familiar with SQL and the JDBC API. Hibernate persistent objects are based on plain-old Java objects and Java collections. ..... The following list contains the type of code that you would write inside a persistence framework:

           

          • Querying relational information into objects. Hibernate does this through an OO query language called HQL, or by using an expressive criteria API. HQL is very similar to SQL except you use objects instead of tables and fields instead of columns. There are some new specific HQL language elements to learn; however, they are easy to understand and well documented. HQL is a natural language to use for querying objects that require a small learning curve.
          • Saving, updating, and deleting information stored in a database.
          • Advanced object-to-relational mapping frameworks like Hibernate have support for most major SQL databases, and they support parent/child relationships, transactions, inheritance, and polymorphism.

           

          Here are some items that should be avoided in the persistence layer:

           

          • Business logic should be in a higher layer of your application. Only data access operations should be permitted.
          • You should not have persistence logic coupled with your presentation logic. Avoid logic in presentation components such as JSPs or servlet-based classes that communicate with data access directly.

           

          By isolating persistence logic into its own layer, the application becomes flexible to change without affecting code in other layers. For example, Hibernate could be replaced with another persistence framework or API without modification to the code in any other layer.

           

          Excerpt from "Wiring Your Web Application with Open Source Java" by Mark Eagle

           

          [NoteThis blog was migrated from my very old blog which was in the blogspirit.]


          Yourit ,
          Mycat Programming

          posted on 2005-06-02 09:14 kukooBlog 閱讀(878) 評論(0)  編輯  收藏 所屬分類: JavaProgramming
          主站蜘蛛池模板: 泸水县| 盱眙县| 荥阳市| 太保市| 获嘉县| 绥化市| 宁南县| 志丹县| 瑞安市| 麻栗坡县| 会昌县| 浠水县| 鹤峰县| 泾川县| 崇信县| 宁晋县| 行唐县| SHOW| 绥江县| 临沂市| 清新县| 南雄市| 邵武市| 邢台县| 屯昌县| 洞头县| 长寿区| 南靖县| 临猗县| 镇巴县| 宁陵县| 曲麻莱县| 布拖县| 五常市| 大冶市| 兴文县| 曲靖市| 岑巩县| 叶城县| 富蕴县| 清水县|