devxlogo

Unwrapping a Session from EntityManager

Unwrapping a Session from EntityManager

When we need access to a Hibernate Session, we have to unwrap it from the current EntityManager via the unwrap() method as follows:

// Spring and Java EE EntityManager em = ...;Session session = em.unwrap(Session.class);

devx-admin

Share the Post: