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/ParentChildTest.java | |||
Method name: void testObjectType()
|
Method name: void testObjectType()
|
|||
Number of AST nodes: 17 | Number of AST nodes: 17 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | GlarchProxy g = new Glarch();↵ | 2 | Parent g = new Parent();↵ | |
3 | Foo foo = new Foo();↵ | 3 | Foo foo = new Foo();↵ | |
4 | g.setAny(foo);↵ | 4 | g.setAny(foo);↵ | |
5 | Serializable gid = s.save(g);↵ | 5 | s.save(g);↵ | |
6 | s.save(foo);↵ | 6 | s.save(foo);↵ | |
7 | s.flush();↵ | 7 | s.flush();↵ | |
8 | s.connection().commit();↵ | 8 | s.connection().commit();↵ | |
9 | s.close();↵ | 9 | s.close();↵ | |
10 | s = openSession();↵ | 10 | s = openSession();↵ | |
11 | g = (GlarchProxy) s.load(Glarch.class, gid);↵ | 11 | g = (Parent) s.load( Parent.class, new Long( g.getId() ) );↵ | |
12 | assertTrue( g.getAny()!=null && g.getAny() instanceof FooProxy );↵ | 12 | assertTrue( g.getAny()!=null && g.getAny() instanceof FooProxy );↵ | |
13 | s.delete( g.getAny() );↵ | 13 | s.delete( g.getAny() );↵ | |
14 | s.delete(g);↵ | 14 | s.delete(g);↵ | |
15 | //s.delete( g.getAny() );↵ | 15 | ↵ | |
16 | s.flush();↵ | 16 | s.flush();↵ | |
17 | s.connection().commit();↵ | 17 | s.connection().commit();↵ | |
18 | s.close(); | 18 |
| |
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 in different classes having the same super class |
Number of node comparisons | 97 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
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 | Parent g = new Parent(); | |||||||||||||||||
2 | GlarchProxy g = new Glarch(); | | |||||||||||||||||
3 | Foo foo = new Foo(); | 3 | Foo foo = new Foo(); | ||||||||||||||||
4 | g.setAny(foo); |
| 4 | g.setAny(foo); | |||||||||||||||
|
| 5 | s.save(g); | ||||||||||||||||
5 | Serializable gid = s.save(g); |
| | ||||||||||||||||
6 | s.save(foo); | 6 | s.save(foo); | ||||||||||||||||
7 | s.flush(); | 7 | s.flush(); | ||||||||||||||||
8 | s.connection().commit(); | 8 | s.connection().commit(); | ||||||||||||||||
9 | s.close(); | 9 | s.close(); | ||||||||||||||||
10 | s = openSession(); | 10 | s = openSession(); | ||||||||||||||||
|
| 11 | g = (Parent)s.load(Parent.class, new Long(g.getId())); | ||||||||||||||||
11 | g = (GlarchProxy)s.load(Glarch.class, gid); |
| | ||||||||||||||||
12 | assertTrue(g.getAny() != null && g.getAny() instanceof FooProxy); |
| 12 | assertTrue(g.getAny() != null && g.getAny() instanceof FooProxy); | |||||||||||||||
13 | s.delete(g.getAny()); |
| 13 | s.delete(g.getAny()); | |||||||||||||||
14 | s.delete(g); |
| 14 | s.delete(g); | |||||||||||||||
15 | s.flush(); | 15 | s.flush(); | ||||||||||||||||
16 | s.connection().commit(); | 16 | s.connection().commit(); | ||||||||||||||||
17 | s.close(); | 17 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.legacy.GlarchProxy of variable g does not match with type org.hibernate.test.legacy.Parent of variable g |
2 | Unmatched statement s.save(g); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement Serializable gid=s.save(g); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement g=(Parent)s.load(Parent.class,new Long(g.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement g=(GlarchProxy)s.load(Glarch.class,gid); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Type org.hibernate.test.legacy.GlarchProxy of variable g does not match with type org.hibernate.test.legacy.Parent of variable g |
7 | Type org.hibernate.test.legacy.GlarchProxy of variable g does not match with type org.hibernate.test.legacy.Parent of variable g |
8 | Type org.hibernate.test.legacy.GlarchProxy of variable g does not match with type org.hibernate.test.legacy.Parent of variable g |
9 | Type org.hibernate.test.legacy.GlarchProxy of variable g does not match with type org.hibernate.test.legacy.Parent of variable g |