diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java b/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java index 0891f98bd3..2bd4e68d5f 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/spi/HibernateEntityManagerImplementor.java @@ -15,8 +15,8 @@ import javax.persistence.criteria.Selection; import org.hibernate.HibernateException; import org.hibernate.LockOptions; import org.hibernate.StaleStateException; +import org.hibernate.ejb.HibernateEntityManager; import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.jpa.HibernateEntityManager; import org.hibernate.query.Query; import org.hibernate.query.criteria.internal.ValueHandlerFactory; import org.hibernate.type.Type; diff --git a/hibernate-core/src/test/java/org/hibernate/test/jpa/EntityManagerUnwrapTest.java b/hibernate-core/src/test/java/org/hibernate/test/jpa/EntityManagerUnwrapTest.java new file mode 100644 index 0000000000..9f54b78590 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/jpa/EntityManagerUnwrapTest.java @@ -0,0 +1,50 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.test.jpa; + +import org.hibernate.Session; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.junit.Test; + +import org.hibernate.testing.TestForIssue; + +/** + * @author Chris Cranford + */ +public class EntityManagerUnwrapTest extends BaseEntityManagerFunctionalTestCase { + @Test + @TestForIssue(jiraKey = "HHH-13281") + public void testUnwrapEjbHibernateEntityManagerInterface() { + org.hibernate.ejb.HibernateEntityManager em = getOrCreateEntityManager().unwrap( org.hibernate.ejb.HibernateEntityManager.class ); + } + + @Test + @TestForIssue(jiraKey = "HHH-13281") + public void testUnwrapJpaHibernateEntityManagerInterface() { + org.hibernate.jpa.HibernateEntityManager em = getOrCreateEntityManager().unwrap( org.hibernate.jpa.HibernateEntityManager.class ); + } + + @Test + @TestForIssue(jiraKey = "HHH-13281") + public void testUnwrapSessionImplementor() { + SessionImplementor session = getOrCreateEntityManager().unwrap( SessionImplementor.class ); + } + + @Test + @TestForIssue(jiraKey = "HHH-13281") + public void testUnwrapSession() { + Session session = getOrCreateEntityManager().unwrap( Session.class ); + } + + @Test + @TestForIssue(jiraKey = "HHH-13281") + public void testUnwrapSharedSessionContractImplementor() { + SharedSessionContractImplementor session = getOrCreateEntityManager().unwrap( SharedSessionContractImplementor.class ); + } +}