The EntityManager has a getDelegate API:
http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.htm...
You can probably do this:
| @PersistenceContext
| EntityManager em;
|
| public void myMethod() {
|
| //get the underlying Hibernate session
| org.hibernate.Session sess = (org.hibernate.Session) em.getDelegate();
|
| //now get the session factory from the hibernate session
| SessionFactory sf = sess.getSessionFactory();
| }
P.S: I don't know why JPA doesn't provide a similar getDelegate() method on the
EntityManagerFactory to access the provider specific entitymanagerfactory.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150946#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...