Why Hibernate should be chosen for projects ? Advantages of Hibernate
I have been working on various projects in which I used hibernate in many projects. However, when in an interview, I was asked about why one should choose hibernate, I thought I should put together the benefits and the reasons to choose Hibernate.
What hibernate is basically ?
Hibernate is an O/R mapping which stands for Object/Relational mapping. This means that hibernate relates/maps objects with the database tables (also known as relations).
Why O/R mapping ?
The developer no more need to write all the SQL manually using the JDBC API. It also helps the developer to concentrate on the business logic of the project instead of giving time to manual SQL queries and the consequent bugs in it. This helps increase the project productivity.
It generates the necessary SQL queries on the backend, making it easy for the developer to maintain the code.
Hibernate is portable. Regardless, of the database, you can write your code and run it with every database just by making a few change in the hibernate configuration file.
Why Hibernate should be chosen over other O/R mapping technologies ?
1. Productivity / Maintainability / Portability
Hibernate provides all the above mentioned O/R mapping features.
2. Its Open Source
Hibernate is open source and companies who tend to work using open source projects can benefit a lot from it.
3. Its Popular
Hibernate is a popular O/R mapping and there is a lot of support for bugs. It has been used in many projects, so there is a 99% chance that if you come across an error or problem using it, you can find it solution on the internet as there are many discussion boards and websites writing about it.
4. Easy to learn
Hibernate is totally object oriented and it is easy to configure and learn.
5. Code generating tool
Many popular IDEs (Netbeans, Eclipse..) provide support for code generation. If you have created you database, you can generate hibernate objects for all the tables with the click of a button.
Hibernate code generation