الخميس، 23 ديسمبر 2010

What is different between Hibernate and iBatis?


In iBatis Java objects are mapped to the result sets.
IBatis only maps the Java bean properties to database fields and it fetches the database results in the form of Java beans based on configuration.


In Hibernate Java objects are mapped to the database tables.

iBATIS maps Java Objects to the results of SQL Queries whereas Hibernate maps Java Objects directly to
database tables traditional Object-Relational Mapping.

The benefits of Hibernate are that it automatically
generates all the SQL for your and the cache invalidation can be more fine grained.

iBATIS is more flexible
especially if we are a strong SQL query writer. We have control over exactly how the SQL queries are written.

iBATIS uses Data Mapper Pattern whereas Hibernate uses Active Record Pattern
=============================================
BATIS is very simple.
Hibernate is much more complex.

If you are a SQL expert and want to write SQL yourself, choose iBATIS.

But if you don't want to write SQL and you prefer more object-oriented query language and have much time to learn OR-mapping concepts and features, choose Hibernate.

iBATIS is so simple, it is just about XML, SQL, and plain-old objects, nothing more than that.

iBATIS is just a data mapper framework it maps fields in RDBMS tables to attributes in objects while Hibernate is an OR-mapping tool it maps objects to relational database.

Sounds similar, but OR-mapping is higher level than data mapping.
=====================================================
Use iBatis if
You want to create your own SQL's and are willing to maintain them
your environment is driven by relational data model
you have to work existing and complex schema's
Use Hibernate if
your environment is driven by object model and wants generates SQL automatically

The message is,
One size does not fit all the java persistence and the important to know there are other solutions besides the traditional ORMs, and that would be iBatis.
Both the solutions work well, given their specific domain.
Look for the opportunity where you can use both.

ليست هناك تعليقات:

إرسال تعليق