Skip to content
Search

Hibernate

lastmod 2024-12-05created 2015-11-186 edits

Hibernate ORM is an object-relational mapping framework for the Java language. It provides a framework for mapping an object-oriented domain model to a relational database.

Hibernate is free software distributed under the GNU LGPL 2.1.

iBatis vs Hibernate

This is a summary of a site1 comparing the characteristics of iBatis and Hibernate. The expression "a wise answer to a foolish question" seems to fit perfectly. To the question "Which of the two is better?", it gives an answer worthy of Prime Minister Hwang Hui: "Both are good. Use each one's strengths as suits your project." Perhaps frameworks are an area that calls for flexible thinking. I feel that you can't get anything done with an exclusive mindset that insists only on your own way.

Classification of the two frameworks

When Hibernate is appropriate

  • A new project has just started
  • The object model and database design are not yet finished

When iBatis is appropriate

  • When accessing 3rd party databases
  • When integration with a legacy database is needed
  • When the work and DB design are in poor shape (messy design)
  • An O/R Mapper may not be able to handle such situations.
  • With an SQL Mapper, there are no constraints on the mapping between the object model and the data model.
  • When SQL statements must be tuned or optimized manually by people

Performance comparison

  • Older embeded sql mapper
    • Built with compiled languages
    • Very fast and optimized for the system environment
  • O/R mapper
    • Does more kinds of work than an sql mapper
    • Mostly the reflection approach (hibernate),
    • the binary code inhencement approach (JDO).
    • Future versions of hibernate adopt the binary code inhencement approach
    • Using the reflection approach is something it has in common with iBatis

Comparing framework performance is meaningless

  • Framework performance depends on how you use the framework
  • In general, an O/R mapper does much more efficient mapping and builds execution strategies compared to an sql mapper.
  • An O/R mapper contains extensive information about the object model and the database model
  • If you use table-to-class mapping for a simple CRUD application, an O/R mapper has many advantages in terms of simplicity and performance
  • In environments with complex data transfer, an sql mapper is efficient
  • An Sql mapper can bring out the advantages of more efficient sql

Conclusion

  • Pick more than one and test them.
  • Test them thoroughly according to the concept of your project.
  • Every project has different characteristics, so you should flexibly use Hibernate, iBATIS SQL Maps, TopLink, or raw JDBC depending on the situation

See also

Favorite site

References


author Zer0 sitemap