File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testForeignKeys()
|
Method name: void testNoForeignKeyViolations()
|
|||
Number of AST nodes: 17 | Number of AST nodes: 17 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Baz baz = new Baz();↵ | 2 | ↵ | |
3 | Foo foo↵ | 3 | Glarch g1 = new Glarch();↵ | |
4 | = new Foo();↵ | 4 | Glarch g2 = new ↵ | |
5 | List bag = new ArrayList();↵ | |||
6 | bag.add(foo↵ | 5 | Glarch();↵ | |
7 | );↵ | 6 | g1.setNext(g2);↵ | |
8 | baz.setIdFooBag(bag);↵ | 7 | g2.set↵ | |
9 | baz.setFoo(foo↵ | 8 | Next(g1);↵ | |
10 | );↵ | 9 | s.save(g1);↵ | |
11 | s.save(baz);↵ | 10 | s.save(g2);↵ | |
12 | s.flush();↵ | 11 | s.flush();↵ | |
13 | s.connection().commit();↵ | 12 | s.connection().commit();↵ | |
14 | s.close();↵ | 13 | s.close();↵ | |
15 | s = openSession();↵ | 14 | s = openSession();↵ | |
16 | baz = (Baz) s.load( Baz.class, baz.getCode(↵ | 15 | List l = s.find("from Glarch g where g.next is not null");↵ | |
17 | ) );↵ | 16 | s.delete( l.get(0) );↵ | |
18 | s.delete(baz);↵ | 17 | s.delete( l.get(1) );↵ | |
19 | s.flush();↵ | 18 | s.flush();↵ | |
20 | s.connection().commit();↵ | 19 | s.connection().commit();↵ | |
21 | s.close(); | 20 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 133 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 8 |
Number of unmapped statements in the second code fragment | 8 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | |||||||||||||||
| 2 | Glarch g1 = new Glarch(); | ||||||||||||||||
2 | Baz baz = new Baz(); | | ||||||||||||||||
| 3 | Glarch g2 = new Glarch(); | ||||||||||||||||
3 | Foo foo = new Foo(); | | ||||||||||||||||
| 4 | g1.setNext(g2); | ||||||||||||||||
4 | List bag = new ArrayList(); | | ||||||||||||||||
| 5 | g2.setNext(g1); | ||||||||||||||||
5 | bag.add(foo); | | ||||||||||||||||
|
| 6 | s.save(g1); | |||||||||||||||
6 | baz.setIdFooBag(bag); | | ||||||||||||||||
7 | baz.setFoo(foo); | | ||||||||||||||||
8 | s.save(baz); |
| 7 | s.save(g2); | ||||||||||||||
9 | s.flush(); | 8 | s.flush(); | |||||||||||||||
10 | s.connection().commit(); | 9 | s.connection().commit(); | |||||||||||||||
11 | s.close(); | 10 | s.close(); | |||||||||||||||
12 | s = openSession(); | 11 | s = openSession(); | |||||||||||||||
| 12 | List l = s.find("from Glarch g where g.next is not null"); | ||||||||||||||||
| 13 | s.delete(l.get(0)); | ||||||||||||||||
13 | baz = (Baz)s.load(Baz.class, baz.getCode()); |
| | |||||||||||||||
| 14 | s.delete(l.get(1)); | ||||||||||||||||
14 | s.delete(baz); | | ||||||||||||||||
15 | s.flush(); | 15 | s.flush(); | |||||||||||||||
16 | s.connection().commit(); | 16 | s.connection().commit(); | |||||||||||||||
17 | s.close(); | 17 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement s.save(g1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Type org.hibernate.test.legacy.Baz of variable baz does not match with type org.hibernate.test.legacy.Glarch of variable g2 |
3 | Unmatched statement baz=(Baz)s.load(Baz.class,baz.getCode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |