|
|
|
@ -53,11 +53,11 @@ class HibernateNativeEntityManagerFactoryIntegrationTests extends AbstractContai |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void testEntityManagerFactoryImplementsEntityManagerFactoryInfo() { |
|
|
|
protected void testEntityManagerFactoryImplementsEntityManagerFactoryInfo() { |
|
|
|
boolean condition = entityManagerFactory instanceof EntityManagerFactoryInfo; |
|
|
|
assertThat(entityManagerFactory).as("Must not have introduced config interface") |
|
|
|
assertThat(condition).as("Must not have introduced config interface").isFalse(); |
|
|
|
.isNotInstanceOf(EntityManagerFactoryInfo.class); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -66,23 +66,21 @@ class HibernateNativeEntityManagerFactoryIntegrationTests extends AbstractContai |
|
|
|
String firstName = "Tony"; |
|
|
|
String firstName = "Tony"; |
|
|
|
insertPerson(firstName); |
|
|
|
insertPerson(firstName); |
|
|
|
|
|
|
|
|
|
|
|
List<Person> people = sharedEntityManager.createQuery("select p from Person as p").getResultList(); |
|
|
|
List<Person> people = sharedEntityManager.createQuery("select p from Person as p", Person.class).getResultList(); |
|
|
|
assertThat(people).hasSize(1); |
|
|
|
assertThat(people).hasSize(1); |
|
|
|
assertThat(people.get(0).getFirstName()).isEqualTo(firstName); |
|
|
|
assertThat(people.get(0).getFirstName()).isEqualTo(firstName); |
|
|
|
assertThat(people.get(0).postLoaded).isSameAs(applicationContext); |
|
|
|
assertThat(people.get(0).postLoaded).isSameAs(applicationContext); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
|
|
|
|
|
|
public void testCurrentSession() { |
|
|
|
public void testCurrentSession() { |
|
|
|
String firstName = "Tony"; |
|
|
|
String firstName = "Tony"; |
|
|
|
insertPerson(firstName); |
|
|
|
insertPerson(firstName); |
|
|
|
|
|
|
|
|
|
|
|
Query q = sessionFactory.getCurrentSession().createQuery("select p from Person as p"); |
|
|
|
Query<Person> q = sessionFactory.getCurrentSession().createQuery("select p from Person as p", Person.class); |
|
|
|
List<Person> people = q.getResultList(); |
|
|
|
assertThat(q.getResultList()).hasSize(1); |
|
|
|
assertThat(people).hasSize(1); |
|
|
|
assertThat(q.getResultList().get(0).getFirstName()).isEqualTo(firstName); |
|
|
|
assertThat(people.get(0).getFirstName()).isEqualTo(firstName); |
|
|
|
assertThat(q.getResultList().get(0).postLoaded).isSameAs(applicationContext); |
|
|
|
assertThat(people.get(0).postLoaded).isSameAs(applicationContext); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test // SPR-16956
|
|
|
|
@Test // SPR-16956
|
|
|
|
|