HHH-11037 : Fix tests to be jdk6-compliant

This commit is contained in:
Gail Badner 2016-08-18 16:03:48 -07:00
parent 366efe118f
commit 840258a00e
3 changed files with 48 additions and 33 deletions

View File

@ -32,11 +32,10 @@ import java.util.Set;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
/**
* @author Andrea Boriero
*/
@ -49,23 +48,29 @@ public class JoinedSubclassWithEmbeddableTest extends BaseCoreFunctionalTestCase
@Test
public void testSelectFromEmbeddedField() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from employee_embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from employee_embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromSubclass() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromParent() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Entity

View File

@ -32,11 +32,10 @@ import java.util.Set;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
/**
* @author Andrea Boriero
*/
@ -50,23 +49,29 @@ public class SingleTableWithEmbeddableTest extends BaseCoreFunctionalTestCase {
@Test
public void testSelectFromEmbeddedField() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from employee_embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from employee_embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromSubclass() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromParent() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Entity

View File

@ -32,11 +32,10 @@ import java.util.Set;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
/**
* @author Andrea Boriero
*/
@ -49,23 +48,29 @@ public class TablePerClassWithEmbeddableTest extends BaseCoreFunctionalTestCase
@Test
public void testSelectFromEmbeddedField() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from employee_embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from employee_embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromSubclass() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from embeddable_person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from embeddable_person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Test
public void testSelectFromParent() {
doInHibernate( this::sessionFactory, session -> {
session.createNativeQuery( "select * from person_map" ).getResultList();
} );
Session session = openSession();
session.getTransaction().begin();
session.createSQLQuery( "select * from person_map" ).list();
session.getTransaction().commit();
session.close();
}
@Entity