2012-08-25 35 views

回答

-1

有很多的這個信息,例如您可以使用此:

org.hibernate.Session session = (Session)entityManager.getDelegate(); 

來源:

source

+3

這裏的答案不涉及「創建或檢索一個Hibernate 4會話工廠「,而是顯示如何從EntityManager獲取Session對象。也許這最終是提問者想知道的,但嚴格按照問題的語言來看是錯誤的。鏈接的文章本身只是解釋如何使用hibernate.cfg.xml作爲persistence.xml配置的一部分,而不是如何僅通過persistence.xml獲取SessionFactory。我認爲答案應該重寫 – Rich

相關問題