Wednesday, March 19, 2014

Disadvantages of Hibernate

• Debugging- Sometimes debugging and performance tuning becomes difficult.

• Slower than JDBC-
Hibernate is slower than pure JDBC as it is generating lots of SQL statements in runtime.

• Not suitable for Batch processing- It advisable to use pure JDBC for batch processing.

• Overhead-
Use of Hibernate is an overhead for the applications which are : simple and use one database that never change, need to put data to database tables, no further SQL queries and  there are no objects which are mapped to two different tables. Hibernate increases extra layers and complexity. So for these types of applications JDBC is the best choice.

• Difficult to maintain- Anybody wanting to maintain application using Hibernate will need to know Hibernate.

• Performance decreases in complex data-For complex data, mapping from Object-to-tables and vice versa reduces performance and increases time of conversion.

• Not allow all queries- Hibernate does not allow some type of queries which are supported by JDBC. For example it does not allow inserting multiple objects to same table using single query. Developer has to write separate query to insert each object.

• High memory consumption- Loading a large number of objects from the database which then reside in memory cause to waste the memory. One approach to resolving this is by using lazy loading, which has a few of its own caveats.

• Difficulties in legacy databases- Hibernate works best and easiest with a brand new database, attempting to use it on an existing legacy database can be quite a difficult task.

• Learning difficulties
– In here you may mess with advantages. Note that  it is quite easy to do the basics in hibernate but to really use hibernate well you need a good knowledge of ORM concepts, the way mappings and the session works and also more advanced concepts such as caching, lazy loading and fetching strategies.

• Performance optimization -Trying to optimize performance at the database level is a bit trickier with Hibernate due to the fact the SQL that is executed is actually generated by Hibernate, hence user  not able to just go in and adjust the SQL accordingly.

No comments:

Post a Comment