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/ops/MergeTest.java | |||
Method name: void testCollectionCache()
|
Method name: void testDeleteAndMerge()
|
|||
Number of AST nodes: 18 | Number of AST nodes: 18 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Baz baz = new Baz();↵ | 2 | ↵ | |
3 | baz.setDefaults();↵ | |||
4 | s.save(baz);↵ | |||
5 | s.flush();↵ | |||
6 | s.conne↵ | 3 | s.getTransaction().begin();↵ | |
4 | Employer jboss = new Employer();↵ | |||
5 | s.persist( jboss );↵ | |||
7 | ction().commit();↵ | 6 | s.getTransaction().commit();↵ | |
8 | s.close();↵ | 7 | s.clear();↵ | |
9 | s = openSession();↵ | 8 | s↵ | |
10 | s.load( Baz↵ | 9 | .getTransaction().begin();↵ | |
10 | Employer otherJboss;↵ | |||
11 | .class, baz.getCode() );↵ | 11 | otherJboss = (Employer) s.get( Employer.class, ↵ | |
12 | s.flush();↵ | |||
13 | s.conne↵ | 12 | jboss.getId() );↵ | |
13 | s.delete( otherJboss );↵ | |||
14 | ction().commit();↵ | 14 | s.getTransaction().commit();↵ | |
15 | s.close();↵ | 15 | s.clear();↵ | |
16 | s = openSession();↵ | 16 | ↵ | |
17 | baz = (Baz) s.load( Baz.class, baz.getCode() );↵ | |||
18 | s.delete(baz);↵ | |||
19 | s.flush();↵ | |||
20 | s.conne↵ | 17 | jboss.setVers( new Integer(1) );↵ | |
18 | s.getTransaction().begin();↵ | |||
19 | s.merge( jboss );↵ | |||
21 | ction().commit();↵ | 20 | s.getTransaction().commit();↵ | |
22 | s.close(); | 21 | s.close();↵ | |
22 |
| |||
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 | 324 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 13 |
Number of unmapped statements in the second code fragment | 13 |
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 | s.getTransaction().begin(); | ||||||||||||||||||||
2 | Baz baz = new Baz(); | | |||||||||||||||||||||
| 3 | Employer jboss = new Employer(); | |||||||||||||||||||||
3 | baz.setDefaults(); |
| | ||||||||||||||||||||
|
| 4 | s.persist(jboss); | ||||||||||||||||||||
4 | s.save(baz); |
| | ||||||||||||||||||||
5 | s.flush(); |
| 6 | s.clear(); | |||||||||||||||||||
6 | s.connection().commit(); |
| 5 | s.getTransaction().commit(); | |||||||||||||||||||
|
| 7 | s.getTransaction().begin(); | ||||||||||||||||||||
| 8 | Employer otherJboss; | |||||||||||||||||||||
|
| 9 | otherJboss = (Employer)s.get(Employer.class, jboss.getId()); | ||||||||||||||||||||
7 | s.close(); |
| 17 | s.close(); | |||||||||||||||||||
8 | s = openSession(); |
| | ||||||||||||||||||||
9 | s.load(Baz.class, baz.getCode()); | | |||||||||||||||||||||
|
| 10 | s.delete(otherJboss); | ||||||||||||||||||||
|
| 11 | s.getTransaction().commit(); | ||||||||||||||||||||
10 | s.flush(); |
| 18 | cleanup(); | |||||||||||||||||||
11 | s.connection().commit(); | | |||||||||||||||||||||
|
| 12 | s.clear(); | ||||||||||||||||||||
12 | s.close(); | | |||||||||||||||||||||
|
| 13 | jboss.setVers(new Integer(1)); | ||||||||||||||||||||
13 | s = openSession(); |
| | ||||||||||||||||||||
|
| 14 | s.getTransaction().begin(); | ||||||||||||||||||||
14 | baz = (Baz)s.load(Baz.class, baz.getCode()); | | |||||||||||||||||||||
|
| 15 | s.merge(jboss); | ||||||||||||||||||||
15 | s.delete(baz); | | |||||||||||||||||||||
|
| 16 | s.getTransaction().commit(); | ||||||||||||||||||||
16 | s.flush(); | | |||||||||||||||||||||
17 | s.connection().commit(); | | |||||||||||||||||||||
18 | s.close(); | |
Row | Violation |
---|---|
1 | Unmatched statement s.getTransaction().begin(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement baz.setDefaults(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement s.persist(jboss); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement s.save(baz); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression s.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
8 | Expression s.clear() is a void method call, and thus it cannot be parameterized |
9 | Expression s.connection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Type java.sql.Connection of variable s.connection() does not match with type org.hibernate.Transaction of variable s.getTransaction() |
12 | Unmatched statement s.getTransaction().begin(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Unmatched statement otherJboss=(Employer)s.get(Employer.class,jboss.getId()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Unmatched statement s.delete(otherJboss); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement s.getTransaction().commit(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
17 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
19 | Expression cleanup() is a void method call, and thus it cannot be parameterized |
20 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
22 | Expression cleanup() is a void method call, and thus it cannot be parameterized |
23 | Unmatched statement s.clear(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
24 | Unmatched statement jboss.setVers(new Integer(1)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
25 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
26 | Unmatched statement s.getTransaction().begin(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
27 | Unmatched statement s.merge(jboss); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
28 | Unmatched statement s.getTransaction().commit(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
29 | Clone fragment #1 returns variable s with type org.hibernate.classic.Session , while Clone fragment #2 returns variable s with type org.hibernate.Session |