@ -81,6 +84,10 @@ public abstract class AbstractEntityManagerFactoryIntegrationTests extends Abstr
@@ -81,6 +84,10 @@ public abstract class AbstractEntityManagerFactoryIntegrationTests extends Abstr
@ -93,7 +93,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
@@ -93,7 +93,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
em.persist(p);
em.flush();
assertEquals("1 row must have been inserted",1,countRowsInTable("person"));
assertEquals("1 row must have been inserted",1,countRowsInTable(em,"person"));
}
publicvoidtestStateClean(){
@ -122,14 +122,14 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
@@ -122,14 +122,14 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
setComplete();
endTransaction();// Should rollback
assertEquals("Tx must have committed back",
1,countRowsInTable("person"));
1,countRowsInTable(em,"person"));
// Now clean up the database
startNewTransaction();
em.joinTransaction();
deleteAllPeopleUsingEntityManager(em);
assertEquals("People have been killed",
0,countRowsInTable("person"));
0,countRowsInTable(em,"person"));
setComplete();
}
@ -143,7 +143,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
@@ -143,7 +143,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
doInstantiateAndSave(em);
endTransaction();// Should rollback
assertEquals("Tx must have been rolled back",
0,countRowsInTable("person"));
0,countRowsInTable(em,"person"));
}
publicvoidtestCommitOccurs(){
@ -154,7 +154,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
@@ -154,7 +154,7 @@ public class ApplicationManagedEntityManagerIntegrationTests extends AbstractEnt
@ -105,7 +105,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@@ -105,7 +105,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
publicvoiddoInstantiateAndSave(EntityManagerem){
assertEquals("Should be no people from previous transactions",
0,countRowsInTable("person"));
0,countRowsInTable(em,"person"));
Personp=newPerson();
p.setFirstName("Tony");
@ -113,7 +113,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@@ -113,7 +113,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
em.persist(p);
em.flush();
assertEquals("1 row must have been inserted",1,countRowsInTable("person"));
assertEquals("1 row must have been inserted",1,countRowsInTable(em,"person"));
}
publicvoidtestReuseInNewTransaction(){
@ -132,7 +132,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@@ -132,7 +132,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
setComplete();
endTransaction();// Should rollback
assertEquals("Tx must have committed back",
1,countRowsInTable("person"));
1,countRowsInTable(em,"person"));
// Now clean up the database
deleteFromTables(newString[]{"person"});
@ -143,7 +143,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@@ -143,7 +143,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
doInstantiateAndSave(em);
endTransaction();// Should rollback
assertEquals("Tx must have been rolled back",
0,countRowsInTable("person"));
0,countRowsInTable(em,"person"));
}
publicvoidtestCommitOccurs(){
@ -152,7 +152,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@@ -152,7 +152,7 @@ public class ContainerManagedEntityManagerIntegrationTests extends AbstractEntit
@ -134,7 +134,7 @@ public abstract class AbstractTransactionalDataSourceSpringContextTests
@@ -134,7 +134,7 @@ public abstract class AbstractTransactionalDataSourceSpringContextTests
*@returnthenumberofrowsinthetable
*/
protectedintcountRowsInTable(StringtableName){
returnthis.jdbcTemplate.queryForInt("SELECT COUNT(0) FROM "+tableName);
returnthis.jdbcTemplate.queryForObject("SELECT COUNT(0) FROM "+tableName,Integer.class);
@ -109,7 +109,7 @@ public class HibernateSessionFlushingTests extends AbstractTransactionalJUnit4Sp
@@ -109,7 +109,7 @@ public class HibernateSessionFlushingTests extends AbstractTransactionalJUnit4Sp