Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception {
- Exception error = null;
- SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class);
- sfsb1.createEmployee("Kelly Smith", "Watford, England", 10);
- sfsb1.createEmployee("Alex Scott", "London, England", 20);
- sfsb1.getEmployeeNoTX(10);
- sfsb1.getEmployeeNoTX(20);
- DataSource ds = rawLookup("java:jboss/datasources/ExampleDS", DataSource.class);
- Connection conn = ds.getConnection();
- int deleted = conn.prepareStatement("delete from Employee").executeUpdate();
- // verify that delete worked (or test is invalid)
- assertTrue("was able to delete added rows. delete count=" + deleted, deleted > 1);
- // read deleted data from second level cache
- Employee emp = sfsb1.getEmployeeNoTX(10);
- assertTrue("was able to read deleted database row from second level cache", emp != null);
- }
Add Comment
Please, Sign In to add comment