HHH-13281 - Avoid ClassCastException when unwrapping EntityManager to deprecated org.hibernate.ejb.HibernateEntityManager.
(cherry picked from commit 6813d1f488
)
This commit is contained in:
parent
55d18d0259
commit
3ec7e17959
|
@ -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;
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
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 );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue