Hibernate SessionFactory vs. EntityManagerFactory
问题 I am new to Hibernate and am unclear of whether to use a SessionFactory or EntityManagerFactory to obtain the hibernate session. What is the difference between the two? Pros & Cons? 回答1: Prefer EntityManagerFactory and EntityManager . They are defined by the JPA standard. SessionFactory and Session are hibernate-specific. The EntityManager invokes the hibernate session under the hood. And if you need some specific features that are not available in the EntityManager , you can obtain the