Java Code Examples for org.springframework.orm.jpa.domain.Person#setFirstName()

The following examples show how to use org.springframework.orm.jpa.domain.Person#setFirstName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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");
	}
}
 
Example 2
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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");
	}
}
 
Example 3
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
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");
	}
}
 
Example 4
Source File: ApplicationManagedEntityManagerIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
protected void doInstantiateAndSave(EntityManager em) {
	testStateClean();
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}
 
Example 5
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
protected void testInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person"));
	Person p = new Person();
	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
}
 
Example 6
Source File: ContainerManagedEntityManagerIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
protected void doInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable(em, "person"));
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}
 
Example 7
Source File: ApplicationManagedEntityManagerIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
protected void doInstantiateAndSave(EntityManager em) {
	testStateClean();
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}
 
Example 8
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
protected void testInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person"));
	Person p = new Person();
	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
}
 
Example 9
Source File: ContainerManagedEntityManagerIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
protected void doInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable(em, "person"));
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}
 
Example 10
Source File: ApplicationManagedEntityManagerIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public void doInstantiateAndSave(EntityManager em) {
	testStateClean();
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}
 
Example 11
Source File: AbstractContainerEntityManagerFactoryIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
protected void testInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable("person"));
	Person p = new Person();
	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable("person"));
}
 
Example 12
Source File: ContainerManagedEntityManagerIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public void doInstantiateAndSave(EntityManager em) {
	assertEquals("Should be no people from previous transactions", 0, countRowsInTable(em, "person"));
	Person p = new Person();

	p.setFirstName("Tony");
	p.setLastName("Blair");
	em.persist(p);

	em.flush();
	assertEquals("1 row must have been inserted", 1, countRowsInTable(em, "person"));
}