CHAPTER 1 (Web server extensions) Understanding object/relational persistence Let s now take

CHAPTER 1 Understanding object/relational persistence Let s now take a brief look at the various ways the persistence layer can be implemented by Java applications. Don t worry we ll get to ORM and Hibernate soon. There is much to be learned by looking at other approaches. 1.3.2 Hand-coding a persistence layer with SQL/JDBC The most common approach to Java persistence is for application programmers to work directly with SQL and JDBC. After all, developers are familiar with relational database management systems, they understand SQL, and they know how to work with tables and foreign keys. Moreover, they can always use the well-known and widely used data access object (DAO) pattern to hide complex JDBC code and nonportable SQL from the business logic. The DAO pattern is a good one so good that we often recommend its use even with ORM. However, the work involved in manually coding persistence for each domain class is considerable, particularly when multiple SQL dialects are supported. This work usually ends up consuming a large portion of the development effort. Furthermore, when requirements change, a hand-coded solution always requires more attention and maintenance effort. Why not implement a simple mapping framework to fit the specific requirements of your project? The result of such an effort could even be reused in future projects. Many developers have taken this approach; numerous homegrown object/relational persistence layers are in production systems today. However, we don t recommend this approach. Excellent solutions already exist: not only the (mostly expensive) tools sold by commercial vendors, but also open source projects with free licenses. We re certain you ll be able to find a solution that meets your requirements, both business and technical. It s likely that such a solution will do a great deal more, and do it better, than a solution you could build in a limited time. Developing a reasonably full-featured ORM may take many developers months. For example, Hibernate is about 80,000 lines of code, some of which is much more difficult than typical application code, along with 25,000 lines of unit test code. This may be more code than is in your application. A great many details can easily be overlooked in such a large project as both the authors know from experience! Even if an existing tool doesn t fully implement two or three of your more exotic requirements, it s still probably not worth creating your own tool. Any ORM software will handle the tedious common cases the ones that kill productivity. It s OK if you need to hand-code certain special cases; few applications are composed primarily of special cases.
We recommend high quality webhost to host and run your jsp application: christian web host services.