如何从Websphere的EntityManager获取hibernate会话?
尝试:
EntityManager em = emf.createEntityManager();
session = em.unwrap(Session.class);
GOT:
[5/22/15 14:24:01:049 MSK] 00000099 SystemErr R <openjpa-2.2.3-SNAPSHOT-r422266:1642995 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: EntityManager can not be unwrapped to an instance of "interface org.hibernate.Session".
FailedObject: com.ibm.ws.persistence.EntityManagerImpl@e14c33cf
也试过:
EntityManager em = emf.createEntityManager();
Session session = session = (Session) em.getDelegate();
GOT:
[5/22/15 13:23:45:930 MSK] 00000098 SystemErr R java.lang.ClassCastException: com.ibm.ws.persistence.EntityManagerImpl incompatible with org.hibernate.Session