Hibernate works better if your view is more object-centric. If however you view is more database-centric then Ibatis is a much stronger choice.
Hibernate is object-relation mapping framework (ORM) which maps Java classes to database tables. MyBatis is persistence framework – not ORM. It maps SQL statements to Java methods.
Hibernate has first level cache which is impossible to disable. It means that if you query item through ORM and then delete it directly with SQL, it stays in the cache. You can explicitly clear the cache to get the most updated results from database but unfortunately such behavior may bring errors like “detached entity passed to persist”
If you perform Create/Update/Delete of some complex domain entities Hibernate works well allowing you to just make a POJO and persist/update it. It also does this quickly, unless your domain is quite large.
Run analytic fetch queries (i.e. summation/aggregation queries). IBatis is great for fetch queries where you just want an answer.Hibernate would attempt to load the entire object graph and you’d need to start tuning queries with LazyLoading tricks to keep it working on a large domain. Conversely if you just want some analytic POJO page, the myBatis implementation of the same query would be trivial.