use of org.springframework.orm.jpa.domain.DriversLicense in project spring-framework by spring-projects.
the class AbstractContainerEntityManagerFactoryIntegrationTests method testLazyLoading.
@Test
public void testLazyLoading() {
try {
Person tony = new Person();
tony.setFirstName("Tony");
tony.setLastName("Blair");
tony.setDriversLicense(new DriversLicense("8439DK"));
sharedEntityManager.persist(tony);
setComplete();
endTransaction();
startNewTransaction();
sharedEntityManager.clear();
Person newTony = entityManagerFactory.createEntityManager().getReference(Person.class, tony.getId());
assertNotSame(newTony, tony);
endTransaction();
assertNotNull(newTony.getDriversLicense());
newTony.getDriversLicense().getSerialNumber();
} finally {
deleteFromTables("person", "drivers_license");
}
}
Aggregations