Difference between Hibernate and Hibernate JPA

后端 未结 4 1792
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 11:18

I found a lot of similar questions

  • Difference between Hibernate library and Hibernate JPA library
  • What's the difference between JPA and Hibernate?
4条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 12:01

    To your First question,

    JPA is a Java API specification which describes the management of relational data in applications using Java Platform. where as Hibernate is a ORM (Object Relational Mapping) library which follows JPA specification.

    You can think JPA as a set of Rules which is implemented by Hibernate.

    And answer for your second question,

    As JPA is just an abstracted persistence layer it requires implementation. and Hibernate implements EntityManager interface that uses hibernate SessionManager.

    In this way, you are completely detached from the implementation way, means you can switch to any of Hibernate or OenJPA or any other whenever you want, no additional code changes required.

提交回复
热议问题