By using JDBC, resource leaks and data inconsistency happens as work
is done by the developer.
False.
- Work is done by developer with hibernate also.
- If you mean that resource leaks happen because of repetitive code for manual
Connection
/(Prepared
)Statement
/ResultSet
handling, there are lots of JDBC template frameworks that do this for you.
- Data inconsistency can happen with Hibernate also if you don't use it properly. For example, you instructed Hibernate to remove something from the database, but it ignored it because
persist
operation is cascaded to the removed entity. And now you have an inconsistent state in the db.
Hard to implement MVC concept
Partially true. Entities really help writing model part of MVC much easier.
No Encapsulation
Partially true. Indeed, mapping information can be specified in the entities only and are later automatically and (more or less) transparently reused in all use cases involving the entities.
Large programming overhead
Absolutely true. Basically, ORM solutions are frameworks that you would sooner or later end up writing by yourself when the persistence layer becomes too complex in your application. In my experience, even in moderately sized applications, manually written persistence frameworks are the most complex parts of the application.
Query is DBMS specific
True. Although there is nothing wrong in using native queries in use cases when HQL is not suitable for the job.
Are there any more factors to support this?
Other questions on SO:
Pros and Cons of Hibernate
Weaknesses of Hibernate
Hibernate or JDBC
JDBC VS Hibernate
Use Hibernate or not?
There are also hundreds of blogs and forum topics on this subject, you will quickly find them with your preferred web search engine.