File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/dialect/functional/cache/SQLFunctionsInterSystemsTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/SQLFunctionsTest.java | |||
Method name: void testCachedQueryOnInsert()
|
Method name: void testCachedQueryOnInsert()
|
|||
Number of AST nodes: 45 | Number of AST nodes: 45 | |||
1 | Session s = openSession(); ↵ | 1 | Session s = openSession();↵ | |
2 | Transaction t = s.beginTransaction(); ↵ | 2 | Transaction t = s.beginTransaction();↵ | |
3 | Simple simple = new Simple(); ↵ | 3 | Simple simple = new Simple();↵ | |
4 | simple.setName("Simple 1"); ↵ | 4 | simple.setName("Simple 1");↵ | |
5 | s.save( simple, new Long(10) ); ↵ | 5 | s.save( simple, new Long(10) );↵ | |
6 | t.commit(); ↵ | 6 | t.commit();↵ | |
7 | s.close();↵ | 7 | s.close();↵ | |
8 | ↵ | |||
9 | s = openSession(); ↵ | 8 | s = openSession();↵ | |
10 | t = s.beginTransaction(); ↵ | 9 | t = s.beginTransaction();↵ | |
11 | Query q = s.createQuery("from Simple s"); ↵ | 10 | Query q = s.createQuery("from Simple s");↵ | |
12 | List list = q.setCacheable(true).list(); ↵ | 11 | List list = q.setCacheable(true).list();↵ | |
13 | assertTrue( list.size()==1 ); ↵ | 12 | assertTrue( list.size()==1 );↵ | |
14 | t.commit(); ↵ | 13 | t.commit();↵ | |
15 | s.close();↵ | 14 | s.close();↵ | |
16 | ↵ | |||
17 | s = openSession(); ↵ | 15 | s = openSession();↵ | |
18 | t = s.beginTransaction(); ↵ | 16 | t = s.beginTransaction();↵ | |
19 | q = s.createQuery("from Simple s"); ↵ | 17 | q = s.createQuery("from Simple s");↵ | |
20 | list = q.setCacheable(true).list(); ↵ | 18 | list = q.setCacheable(true).list();↵ | |
21 | assertTrue( list.size()==1 ); ↵ | 19 | assertTrue( list.size()==1 );↵ | |
22 | t.commit(); ↵ | 20 | t.commit();↵ | |
23 | s.close();↵ | 21 | s.close();↵ | |
24 | ↵ | |||
25 | s = openSession(); ↵ | 22 | s = openSession();↵ | |
26 | t = s.beginTransaction(); ↵ | 23 | t = s.beginTransaction();↵ | |
27 | Simple simple2 = new Simple(); ↵ | 24 | Simple simple2 = new Simple();↵ | |
28 | simple2.setCount(133); ↵ | 25 | simple2.setCount(133);↵ | |
29 | s.save( simple2, new Long(12) ); ↵ | 26 | s.save( simple2, new Long(12) );↵ | |
30 | t.commit(); ↵ | 27 | t.commit();↵ | |
31 | s.close();↵ | 28 | s.close();↵ | |
32 | ↵ | |||
33 | s = openSession(); ↵ | 29 | s = openSession();↵ | |
34 | t = s.beginTransaction(); ↵ | 30 | t = s.beginTransaction();↵ | |
35 | q = s.createQuery("from Simple s"); ↵ | 31 | q = s.createQuery("from Simple s");↵ | |
36 | list = q.setCacheable(true).list(); ↵ | 32 | list = q.setCacheable(true).list();↵ | |
37 | assertTrue( list.size()==2 ); ↵ | 33 | assertTrue( list.size()==2 );↵ | |
38 | t.commit(); ↵ | 34 | t.commit();↵ | |
39 | s.close();↵ | 35 | s.close();↵ | |
40 | ↵ | |||
41 | s = openSession(); ↵ | 36 | s = openSession();↵ | |
42 | t = s.beginTransaction(); ↵ | 37 | t = s.beginTransaction();↵ | |
43 | q = s.createQuery("from Simple s"); ↵ | 38 | q = s.createQuery("from Simple s");↵ | |
44 | list = q.setCacheable(true).list(); ↵ | 39 | list = q.setCacheable(true).list();↵ | |
45 | assertTrue( list.size()==2 ); ↵ | 40 | assertTrue( list.size()==2 );↵ | |
46 | Iterator i = list.iterator(); ↵ | 41 | Iterator i = list.iterator();↵ | |
47 | while ( i.hasNext() ) s.delete( i.next() ); ↵ | 42 | while ( i.hasNext() ) s.delete( i.next() );↵ | |
48 | t.commit(); ↵ | 43 | t.commit();↵ | |
49 | s.close(); | 44 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 334 |
Number of mapped statements | 45 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 22.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | |
2 | Transaction t = s.beginTransaction(); | 2 | Transaction t = s.beginTransaction(); | |
3 | Simple simple = new Simple(); | 3 | Simple simple = new Simple(); | |
4 | simple.setName("Simple 1"); | 4 | simple.setName("Simple 1"); | |
5 | s.save(simple, new Long(10)); | 5 | s.save(simple, new Long(10)); | |
6 | t.commit(); | 6 | t.commit(); | |
7 | s.close(); | 7 | s.close(); | |
8 | s = openSession(); | 8 | s = openSession(); | |
9 | t = s.beginTransaction(); | 9 | t = s.beginTransaction(); | |
10 | Query q = s.createQuery("from Simple s"); | 10 | Query q = s.createQuery("from Simple s"); | |
11 | List list = q.setCacheable(true).list(); | 11 | List list = q.setCacheable(true).list(); | |
12 | assertTrue(list.size() == 1); | 12 | assertTrue(list.size() == 1); | |
13 | t.commit(); | 13 | t.commit(); | |
14 | s.close(); | 14 | s.close(); | |
15 | s = openSession(); | 15 | s = openSession(); | |
16 | t = s.beginTransaction(); | 16 | t = s.beginTransaction(); | |
17 | q = s.createQuery("from Simple s"); | 17 | q = s.createQuery("from Simple s"); | |
18 | list = q.setCacheable(true).list(); | 18 | list = q.setCacheable(true).list(); | |
19 | assertTrue(list.size() == 1); | 19 | assertTrue(list.size() == 1); | |
20 | t.commit(); | 20 | t.commit(); | |
21 | s.close(); | 21 | s.close(); | |
22 | s = openSession(); | 22 | s = openSession(); | |
23 | t = s.beginTransaction(); | 23 | t = s.beginTransaction(); | |
24 | Simple simple2 = new Simple(); | 24 | Simple simple2 = new Simple(); | |
25 | simple2.setCount(133); | 25 | simple2.setCount(133); | |
26 | s.save(simple2, new Long(12)); | 26 | s.save(simple2, new Long(12)); | |
27 | t.commit(); | 27 | t.commit(); | |
28 | s.close(); | 28 | s.close(); | |
29 | s = openSession(); | 29 | s = openSession(); | |
30 | t = s.beginTransaction(); | 30 | t = s.beginTransaction(); | |
31 | q = s.createQuery("from Simple s"); | 31 | q = s.createQuery("from Simple s"); | |
32 | list = q.setCacheable(true).list(); | 32 | list = q.setCacheable(true).list(); | |
33 | assertTrue(list.size() == 2); | 33 | assertTrue(list.size() == 2); | |
34 | t.commit(); | 34 | t.commit(); | |
35 | s.close(); | 35 | s.close(); | |
36 | s = openSession(); | 36 | s = openSession(); | |
37 | t = s.beginTransaction(); | 37 | t = s.beginTransaction(); | |
38 | q = s.createQuery("from Simple s"); | 38 | q = s.createQuery("from Simple s"); | |
39 | list = q.setCacheable(true).list(); | 39 | list = q.setCacheable(true).list(); | |
40 | assertTrue(list.size() == 2); | 40 | assertTrue(list.size() == 2); | |
41 | Iterator i = list.iterator(); | 41 | Iterator i = list.iterator(); | |
42 | while (i.hasNext()) | 42 | while (i.hasNext()) | |
43 | s.delete(i.next()); | 43 | s.delete(i.next()); | |
44 | t.commit(); | 44 | t.commit(); | |
45 | s.close(); | 45 | s.close(); |
Row | Violation |
---|