File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cascade/MultiPathCascadeTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testMultiPathGetAndModify()
|
Method name: void testCreate()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction();↵ | 2 | ↵ | |
3 | A a = new A();↵ | 3 | Foo foo = new Foo();↵ | |
4 | a.setData( "Anna" );↵ | 4 | s.s↵ | |
5 | s.save( a );↵ | |||
6 | s.getTransa↵ | 5 | ave(foo);↵ | |
6 | s.flush();↵ | |||
7 | ction().commit();↵ | 7 | s.connection().commit();↵ | |
8 | s.close();↵ | 8 | s.close();↵ | |
9 | s = openSession();↵ | 9 | s = openSession();↵ | |
10 | s.beginTransaction();↵ | 10 | ↵ | |
11 | // retrieve the previously saved instance from the database, and update it↵ | |||
12 | a = ( A ) s.get( A.class, new Long( a.getId() ) );↵ | |||
13 | modifyEntity( a );↵ | |||
14 | s.getTransaction().commit();↵ | |||
15 | s.close();↵ | |||
16 | verifyModifications( a.getId() ↵ | 11 | Foo foo2 = new Foo();↵ | |
12 | s.load( foo2, foo.getKey() );↵ | |||
13 | // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15↵ | |||
14 | assertTrue( "create", foo.equalsFoo(foo2) );↵ | |||
15 | s.delete(foo2);↵ | |||
16 | s.flush();↵ | |||
17 | s.connection().commit();↵ | |||
17 | ); | 18 | s.close(); | |
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 | 148 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 6 |
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 | Foo foo = new Foo(); | ||||||||||||||||||||||||
2 | s.beginTransaction(); | | ||||||||||||||||||||||||
3 | A a = new A(); | | ||||||||||||||||||||||||
4 | a.setData("Anna"); |
| 10 | assertTrue("create", foo.equalsFoo(foo2)); | ||||||||||||||||||||||
5 | s.save(a); |
| 3 | s.save(foo); | ||||||||||||||||||||||
| 4 | s.flush(); | ||||||||||||||||||||||||
6 | s.getTransaction().commit(); |
| 5 | s.connection().commit(); | ||||||||||||||||||||||
7 | s.close(); |
| 6 | s.close(); | ||||||||||||||||||||||
|
| 7 | s = openSession(); | |||||||||||||||||||||||
| 8 | Foo foo2 = new Foo(); | ||||||||||||||||||||||||
8 | s = openSession(); |
| | |||||||||||||||||||||||
9 | s.beginTransaction(); | | ||||||||||||||||||||||||
10 | a = (A)s.get(A.class, new Long(a.getId())); |
| | |||||||||||||||||||||||
11 | modifyEntity(a); |
| 9 | s.load(foo2, foo.getKey()); | ||||||||||||||||||||||
| 11 | s.delete(foo2); | ||||||||||||||||||||||||
12 | s.getTransaction().commit(); |
| 13 | s.connection().commit(); | ||||||||||||||||||||||
13 | s.close(); |
| 14 | s.close(); | ||||||||||||||||||||||
14 | verifyModifications(a.getId()); |
| 12 | s.flush(); |
Row | Violation |
---|---|
1 | Expression a.setData("Anna") is a void method call, and thus it cannot be parameterized |
2 | Expression assertTrue("create",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
3 | Expression a.setData("Anna") is a void method call, and thus it cannot be parameterized |
4 | Expression assertTrue("create",foo.equalsFoo(foo2)) is a void method call, and thus it cannot be parameterized |
5 | Type org.hibernate.test.cascade.A of variable a does not match with type org.hibernate.test.legacy.Foo of variable foo |
6 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
7 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
8 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
9 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
10 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
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 | Unmatched statement a=(A)s.get(A.class,new Long(a.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Expression modifyEntity(a) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression modifyEntity(a) is a void method call, and thus it cannot be parameterized |
15 | Expression s.load(foo2,foo.getKey()) is a void method call, and thus it cannot be parameterized |
16 | Expression modifyEntity(a) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression modifyEntity(a) is a void method call, and thus it cannot be parameterized |
18 | Expression s.load(foo2,foo.getKey()) is a void method call, and thus it cannot be parameterized |
19 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
20 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
21 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
22 | Expression verifyModifications(a.getId()) is a void method call, and thus it cannot be parameterized |
23 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
24 | Expression verifyModifications(a.getId()) is a void method call, and thus it cannot be parameterized |
25 | Expression s.flush() is a void method call, and thus it cannot be parameterized |