Search code examples
hibernate

Is Hibernate a Framework? or Library?


I am a student learning Hibernate ORM. Sorry for bad english.

The official Hibernate ORM documentation introduces it as a framework. check this documentation : "https://hibernate.org/orm/"

However, the following link claims that Hibernate is not a framework. check this documentation : "https://docs.jboss.org/hibernate/orm/6.5/introduction/html_single/Hibernate_Introduction.html#persistence-contexts"

I am confused about which is correct.

I thought there was inversion of control to solve the impedance-mismatch problem.

To save an object to a database table using the JDBC API, it needs to be converted into a data structure.

However, the perspectives of objects and database data structures are different. I understand this as the impedance-mismatch problem. To solve this, developers need to write a lot of control code, which is difficult to maintain.

I understand that ORM technology emerged to resolve the impedance-mismatch problem. And I think that the control code for resolving the impedance-mismatch problem has been shifted to the ORM side.

So, Regardless of what is written in the document. I think Hibernate is a framework. Please provide feedback.


Solution

  • If we take the definition of Framework from Wikipedia - yes, Hibernate is a framework, all four key features - IoC, Default behavior, Extensibility, and Non-modifiable framework code - are present.

    I suppose, your are puzzled by this part of the documentation:

    Hibernate is an architecture-agnostic library, not a framework, and therefore integrates comfortably with a wide range of Java frameworks and containers.

    First, right before this point, in the documentation there is a disclaimer that this is not a fact, but just an opinion. I think they wanted to say that Hibernate is not an architectural framework and is responsible only for the persistence layer.

    Second (that is this time my personal opinion), any persistence framework affects the whole applications architecture anyway, because provides transaction management, and that is what you need to keep in mind while implementing layers over the persistence one (service layer, for example).