Ibatis 简明教程

iBATIS - Hibernate

iBATIS和Hibernate之间有很大的不同。这两种解决方案在给定其特定领域时都能正常工作。如下所述建议使用iBATIS−

There are major differences between iBATIS and Hibernate. Both the solutions work well, given their specific domain. iBATIS is suggested in case −

  1. You want to create your own SQL’s and you are willing to maintain them.

  2. Your environment is driven by relational data model.

  3. You have to work on existing and complex schemas.

如果环境是由对象模型驱动的并且需要自动生成SQL,则使用Hibernate。

Use Hibernate if the environment is driven by object model and needs to generate SQL automatically.

Difference between iBATIS and Hibernate

Hibernate和iBATIS都是业界可用的开源对象关系映射(ORM)工具。每种工具的使用取决于您使用它们的上下文。

Both Hibernate and iBATIS are open source Object Relational Mapping (ORM) tools available in the industry. Use of each of these tools depends on the context you are using them.

下表重点介绍了iBATIS和Hibernate之间的差异−

The following table highlights the differences between iBATIS and Hibernate −

iBATIS

Hibernate

iBATIS is simpler. It comes in a much smaller package size.

Hibernate generates SQL for you which means you don’t have to spend time on generating SQL.

iBATIS is flexible. It offers faster development time.

Hibernate is highly scalable. It provides a much more advanced cache.

iBATIS uses SQL which could be database dependent.

Hibernate uses HQL which is relatively independent of databases. It is easier to change db in Hibernate.

iBatis maps the ResultSet from JDBC API to your POJO Objets, so you don’t have to care about table structures.

Hibernate maps your Java POJO objects to the Database tables.

It is quite easy to use stored procedure in iBATIS.

Use of stored procedures is a little difficult in Hibernate.

Hibernate和iBATIS都受到SPRING框架的良好支持,因此选择其中一个应该不是问题。

Both Hibernate and iBATIS receive good support from the SPRING framework, so it should not be a problem to choose one of them.