Saturday, June 26, 2010

Why do you need ORM tools like hibernate? (summaried by me)

更多精彩请到 http://www.139ya.com

The main advantage of ORM like hibernate is that it shields developers from messy SQL. Apart from this, ORM provides following benefits:

Improved productivity
  • High-level object-oriented API
  • Less Java code to write
  • No SQL to write
Improved performance
  • Sophisticated caching
  • Lazy loading
  • Eager loading
Improved maintainability
  • A lot less code to write
  • Easy to immigrate between databases, dialect
Improved portability
  • ORM framework generates database-specific SQL for you
Improved the code quality
  • To use the ORM framework, developer need to design and code the model and business layer more reasonably, they need to separate the model and business classes after serious consideration. It isn't like the traditional JDBC programming, software engineer write a very long SQL to cover too many tables and views in one class, it will lead to the performance (bottle neck) problem, and hard to maintain.

No comments: