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