【发布时间】:2020-11-24 16:38:01
【问题描述】:
Session.get() 和EntityManager.find() 有什么区别?我们什么时候应该使用其中之一?
【问题讨论】:
Session.get() 和EntityManager.find() 有什么区别?我们什么时候应该使用其中之一?
【问题讨论】:
Hibernate 为 JPA 提供 implementation 以及它自己的 API。
实际上,这两种方法都做同样的事情:obtaining an entity by primary key。
EntityManager.find() 是 JPA 指定的方式。 Session.get() 是休眠 API 方式。
【讨论】: