Guest User

Untitled

a guest
Oct 15th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. @Test
  2. public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception {
  3. Exception error = null;
  4. SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class);
  5. sfsb1.createEmployee("Kelly Smith", "Watford, England", 10);
  6. sfsb1.createEmployee("Alex Scott", "London, England", 20);
  7. sfsb1.getEmployeeNoTX(10);
  8. sfsb1.getEmployeeNoTX(20);
  9.  
  10. DataSource ds = rawLookup("java:jboss/datasources/ExampleDS", DataSource.class);
  11. Connection conn = ds.getConnection();
  12. int deleted = conn.prepareStatement("delete from Employee").executeUpdate();
  13.  
  14. // verify that delete worked (or test is invalid)
  15. assertTrue("was able to delete added rows. delete count=" + deleted, deleted > 1);
  16.  
  17. // read deleted data from second level cache
  18. Employee emp = sfsb1.getEmployeeNoTX(10);
  19.  
  20. assertTrue("was able to read deleted database row from second level cache", emp != null);
  21. }
Add Comment
Please, Sign In to add comment