【问题标题】:What difference between Session.get() and EntityManager.find() HibernateSession.get() 和 EntityManager.find() Hibernate 有什么区别
【发布时间】:2020-11-24 16:38:01
【问题描述】:

Session.get()EntityManager.find() 有什么区别?我们什么时候应该使用其中之一?

【问题讨论】:

    标签: hibernate jpa orm


    【解决方案1】:

    Hibernate 为 JPA 提供 implementation 以及它自己的 API。

    实际上,这两种方法都做同样的事情:obtaining an entity by primary key

    EntityManager.find() 是 JPA 指定的方式。 Session.get() 是休眠 API 方式。

    【讨论】:

      猜你喜欢
      • 2011-07-25
      • 2011-08-06
      • 2021-09-11
      • 1970-01-01
      • 2012-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多