File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testSuperclassPropertyReferenceAfterCollectionIndexedAccess()
|
Method name: void testCreateUpdate()
|
|||
Number of AST nodes: 30 | Number of AST nodes: 29 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction();↵ | 2 | ↵ | |
3 | Mammal tiger = new Mammal();↵ | 3 | Foo foo = new ↵ | |
4 | tiger.setDescription( "Tiger" );↵ | |||
5 | s.persist( tiger );↵ | |||
6 | Mammal mother = new Mammal();↵ | |||
7 | mother.setDescription( "Tiger's mother" );↵ | |||
8 | mother.setBodyWeight( 4.0f );↵ | |||
9 | mother.addOffspring( tiger );↵ | |||
10 | s.persist( mother ↵ | 4 | Foo();↵ | |
5 | s.save(foo);↵ | |||
6 | foo.setString("dirty");↵ | |||
7 | s.flush();↵ | |||
8 | s.connection().commit();↵ | |||
9 | s.close();↵ | |||
11 | );↵ | 10 | s = openSession();↵ | |
12 | Zoo zoo = new Zoo();↵ | 11 | Foo foo2 = new Foo();↵ | |
13 | zoo.setName( "Austin Zoo" );↵ | 12 | ↵ | |
14 | zoo.setMammals( new HashMap() );↵ | |||
15 | zoo.getMammals().put( "tiger", tiger );↵ | |||
16 | s.persist( zoo );↵ | |||
17 | s.getTransa↵ | 13 | s.load( foo2, foo.getKey() );↵ | |
14 | // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15↵ | |||
15 | assertTrue( "create-update", foo.equalsFoo(foo2) );↵ | |||
16 | //System.out.println( s.print(foo2) );↵ | |||
17 | s.delete(foo2);↵ | |||
18 | s.flush();↵ | |||
18 | ction().commit();↵ | 19 | s.connection().commit();↵ | |
19 | s.close();↵ | 20 | s.close();↵ | |
20 | s = openSession();↵ | 21 | s = openSession();↵ | |
21 | s.beginTransaction();↵ | 22 | ↵ | |
22 | List results = s.createQuery( "from Zoo zoo where zoo.mammals['tiger'].mother.bodyWeight > 3.0f" ).list();↵ | |||
23 | assertEquals( 1, results.size() );↵ | |||
24 | s.getTransa↵ | 23 | foo = new Foo();↵ | |
24 | s.save(foo, "assignedid");↵ | |||
25 | foo.setString("dirty");↵ | |||
26 | s.flush();↵ | |||
25 | ction().commit();↵ | 27 | s.connection().commit();↵ | |
26 | s.close();↵ | 28 | s.close();↵ | |
27 | s = openSession();↵ | 29 | s = openSession();↵ | |
28 | s.beginTransaction();↵ | 30 | s.↵ | |
29 | s.delete( tiger );↵ | |||
30 | s.delete( mother );↵ | |||
31 | s.delete( zoo );↵ | |||
32 | s.getTransa↵ | 31 | load(foo2, "assignedid");↵ | |
32 | // There is an interbase bug that causes null integers to return as 0, also numeric precision is <= 15↵ | |||
33 | assertTrue( "create-update", foo.equalsFoo(foo2) );↵ | |||
34 | //System.out.println( s.print(foo2) );↵ | |||
35 | s.delete(foo2);↵ | |||
36 | s.flush();↵ | |||
33 | ction().commit();↵ | 37 | s.connection().commit();↵ | |
34 | s.close(); | 38 |
| |
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 | 618 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 17 |
Number of unmapped statements in the second code fragment | 16 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); |
| 1 | Session s = openSession(); | ||||||||||||||||||||||||
| 2 | Foo foo = new Foo(); | ||||||||||||||||||||||||||
2 | s.beginTransaction(); |
| | |||||||||||||||||||||||||
|
| 3 | s.save(foo); | |||||||||||||||||||||||||
3 | Mammal tiger = new Mammal(); | | ||||||||||||||||||||||||||
|
| 4 | foo.setString("dirty"); | |||||||||||||||||||||||||
4 | tiger.setDescription("Tiger"); |
| | |||||||||||||||||||||||||
5 | s.persist(tiger); |
| 5 | s.flush(); | ||||||||||||||||||||||||
6 | Mammal mother = new Mammal(); | | ||||||||||||||||||||||||||
|
| 7 | s.close(); | |||||||||||||||||||||||||
7 | mother.setDescription("Tiger's mother"); |
| | |||||||||||||||||||||||||
|
| 8 | s = openSession(); | |||||||||||||||||||||||||
8 | mother.setBodyWeight(4.0f); |
| | |||||||||||||||||||||||||
| 9 | Foo foo2 = new Foo(); | ||||||||||||||||||||||||||
9 | mother.addOffspring(tiger); |
| | |||||||||||||||||||||||||
10 | s.persist(mother); |
| | |||||||||||||||||||||||||
| 11 | assertTrue("create-update", foo.equalsFoo(foo2)); | ||||||||||||||||||||||||||
11 | Zoo zoo = new Zoo(); | | ||||||||||||||||||||||||||
12 | zoo.setName("Austin Zoo"); |
| | |||||||||||||||||||||||||
13 | zoo.setMammals(new HashMap()); |
| | |||||||||||||||||||||||||
14 | zoo.getMammals().put("tiger", tiger); | | ||||||||||||||||||||||||||
15 | s.persist(zoo); |
| | |||||||||||||||||||||||||
16 | s.getTransaction().commit(); |
| 6 | s.connection().commit(); | ||||||||||||||||||||||||
17 | s.close(); |
| 15 | s.close(); | ||||||||||||||||||||||||
18 | s = openSession(); |
| 16 | s = openSession(); | ||||||||||||||||||||||||
|
| 17 | foo = new Foo(); | |||||||||||||||||||||||||
|
| 18 | s.save(foo, "assignedid"); | |||||||||||||||||||||||||
|
| 19 | foo.setString("dirty"); | |||||||||||||||||||||||||
19 | s.beginTransaction(); |
| | |||||||||||||||||||||||||
|
| 20 | s.flush(); | |||||||||||||||||||||||||
20 | List results = s.createQuery("from Zoo zoo where zoo.mammals['tiger'].mother.bodyWeight > 3.0f").list(); |
| | |||||||||||||||||||||||||
21 | assertEquals(1, results.size()); | | ||||||||||||||||||||||||||
22 | s.getTransaction().commit(); |
| 21 | s.connection().commit(); | ||||||||||||||||||||||||
23 | s.close(); |
| 22 | s.close(); | ||||||||||||||||||||||||
24 | s = openSession(); |
| 23 | s = openSession(); | ||||||||||||||||||||||||
25 | s.beginTransaction(); |
| | |||||||||||||||||||||||||
26 | s.delete(tiger); |
| 13 | s.flush(); | ||||||||||||||||||||||||
27 | s.delete(mother); |
| 10 | s.load(foo2, foo.getKey()); | ||||||||||||||||||||||||
28 | s.delete(zoo); |
| 12 | s.delete(foo2); | ||||||||||||||||||||||||
29 | s.getTransaction().commit(); |
| 14 | s.connection().commit(); | ||||||||||||||||||||||||
|
| 24 | s.load(foo2, "assignedid"); | |||||||||||||||||||||||||
| 25 | assertTrue("create-update", foo.equalsFoo(foo2)); | ||||||||||||||||||||||||||
|
| 26 | s.delete(foo2); | |||||||||||||||||||||||||
|
| 27 | s.flush(); | |||||||||||||||||||||||||
|
| 28 | s.connection().commit(); | |||||||||||||||||||||||||
30 | s.close(); |
| 29 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement s.save(foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement foo.setString("dirty"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement tiger.setDescription("Tiger"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Expression s.persist(tiger) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression s.persist(tiger) is a void method call, and thus it cannot be parameterized |
8 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
9 | Expression s.persist(tiger) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression s.persist(tiger) is a void method call, and thus it cannot be parameterized |
12 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
13 | Unmatched statement s.close(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement mother.setDescription("Tiger's mother"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
15 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement mother.setBodyWeight(4.0f); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
17 | Unmatched statement mother.addOffspring(tiger); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
18 | Unmatched statement s.persist(mother); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
19 | Unmatched statement zoo.setName("Austin Zoo"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
20 | Unmatched statement zoo.setMammals(new HashMap()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
21 | Unmatched statement s.persist(zoo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
22 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Expression s.connection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
25 | Unmatched statement foo=new Foo(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
26 | Unmatched statement s.save(foo,"assignedid"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
27 | Unmatched statement foo.setString("dirty"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
28 | Unmatched statement s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
29 | Unmatched statement s.flush(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
30 | Unmatched statement List results=s.createQuery("from Zoo zoo where zoo.mammals['tiger'].mother.bodyWeight > 3.0f").list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
31 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
32 | Expression s.connection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
33 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
34 | Unmatched statement s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
35 | Expression s.delete(tiger) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
37 | Expression s.delete(tiger) is a void method call, and thus it cannot be parameterized |
38 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
39 | Expression s.delete(tiger) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
40 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
41 | Expression s.delete(tiger) is a void method call, and thus it cannot be parameterized |
42 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
43 | Expression s.delete(mother) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
44 | Expression s.load(foo2,foo.getKey()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
45 | Expression s.delete(mother) is a void method call, and thus it cannot be parameterized |
46 | Expression s.load(foo2,foo.getKey()) is a void method call, and thus it cannot be parameterized |
47 | Expression s.delete(mother) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
48 | Expression s.load(foo2,foo.getKey()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
49 | Expression s.delete(mother) is a void method call, and thus it cannot be parameterized |
50 | Expression s.load(foo2,foo.getKey()) is a void method call, and thus it cannot be parameterized |
51 | Type org.hibernate.test.hql.Zoo of variable zoo does not match with type org.hibernate.test.legacy.Foo of variable foo2 |
52 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
53 | Expression s.connection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
54 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
55 | Unmatched statement s.load(foo2,"assignedid"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
56 | Unmatched statement s.delete(foo2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
57 | Unmatched statement s.flush(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
58 | Unmatched statement s.connection().commit(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
59 | Clone fragment #1 returns variable s with type org.hibernate.Session , while Clone fragment #2 returns variable s with type org.hibernate.classic.Session |