File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Difference between Hibernate and MyBatis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Difference between Hibernate and MyBatis" Watch "Difference between Hibernate and MyBatis" New topic
Author

Difference between Hibernate and MyBatis

Avinash Haridasu
Ranch Hand

Joined: Jul 12, 2011
Posts: 31
Hi Friends

I recently started learning Hibernate.

I want to know whether Hibernate is better over MyBatis or vice - versa.

Could any one suggest me any Book on Hibernate.
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

I have no idea about MyBatis but for books: "Java Persistence with Hibernate" is the best book you can read to learn Hibernate in depth.


Piyush
Zoran Roncevic
Greenhorn

Joined: Nov 17, 2011
Posts: 13

Avinash Haridasu wrote:Hi Friends

I recently started learning Hibernate.

I want to know whether Hibernate is better over MyBatis or vice - versa.

Could any one suggest me any Book on Hibernate.


If you don't want to read the whole thing try this:
http://www.youtube.com/watch?v=Yv2xctJxE-w

This guy is great! The series is 30 something tutorials up to 15 min max each. He covers everything in good details. After this tutorials you will be good enough to read the documentation by your self to figure out the rest that you don't know.
Just hit subscribe to thank the guy.

As far as the MyBatis goes, I gave it a look and it quite similar to Hibernate. Some names of the annotations are different but they do the same thing. I wouldn't say it easier than Hibernate, but that is just my thought. maybe somebody that has experience with Mybatis should say something
Kaushik Yeleswarapu
Greenhorn

Joined: Aug 27, 2009
Posts: 5
If you trying to decide on which way to go - hibernate or mybatis. I would say it depends - in which stage of the project you are in. If you are in control of the Class model - starting from the scratch, then you could very well design your classes in line with Hibernate principles. If you are trying to do one off thing in existing application which is following a different db framework, then I would say using mybatis would be very helpful. Also Mybatis is a nobrainer in terms of maintenance, you could directly work/concentrate on the SQL queries - banking on your SQL knowledge. It would be very easy for a new joinee in the team to pickup mybatis when compared to hibernate. While for Hibernate, there is a learning curve involved. Especially if there are some complex joins involved in the application, then Hibernate is going to be quite a challenge though. With mybatis you could come up with the exact query in any query analyzer and use it directly in the mapper file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Hibernate and MyBatis