File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/ops/CreateTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/ops/DeleteTest.java | |||
Method name: void testNoUpdatesOnCreateVersionedWithCollection()
|
Method name: void testNoUpdateOnDeleteWithCollection()
|
|||
Number of AST nodes: 20 | Number of AST nodes: 18 | |||
1 | clearCounts();↵ | |||
2 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
3 | Transaction tx =↵ | |||
4 | s.beginTransaction();↵ | 2 | s.beginTransaction(); ↵ | |
5 | VersionedEntity root = new VersionedEntity( "root", "root" );↵ | 3 | Node parent = new Node( "parent" ); ↵ | |
6 | VersionedEntity child = new VersionedEntity( "c1", "child-1" );↵ | 4 | Node child = new Node( "child" ); ↵ | |
7 | root.getChildren().add( child );↵ | 5 | parent.getCascadingChildren().add( child ); ↵ | |
8 | child.setParent( root );↵ | 6 | s.persist( parent ); ↵ | |
9 | s.save(root);↵ | 7 | s.↵ | |
10 | tx.commit();↵ | 8 | getTransaction().commit(); ↵ | |
11 | s.close();↵ | 9 | s.close();↵ | |
12 | assertInsertCount( 2 );↵ | |||
13 | assertUpdateCount( 0 );↵ | |||
14 | assertDeleteCount( 0 );↵ | |||
10 | clearCounts();↵ | |||
11 | ↵ | |||
15 | s = openSession();↵ | 12 | s = openSession(); ↵ | |
16 | tx = s.beginTransaction();↵ | 13 | s.beginTransaction();↵ | |
14 | parent = ( Node ) s.get( Node.class, "parent" ); ↵ | |||
17 | s.delete( root );↵ | 15 | s.delete( parent ); ↵ | |
18 | tx.commit();↵ | 16 | s.getTransaction().commit(); ↵ | |
19 | s.close();↵ | 17 | s.close();↵ | |
18 | ↵ | |||
20 | assertUpdateCount( 0 );↵ | 19 | assertUpdateCount( 0 );↵ | |
20 | assertInsertCount( 0 ); ↵ | |||
21 | assertDeleteCount( 2 ); | 21 |
| |
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 | 292 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 8 |
Number of unmapped statements in the second code fragment | 6 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | clearCounts(); |
| 6 | s.persist(parent); | ||||||||||||||||||||||
2 | Session s = openSession(); | 1 | Session s = openSession(); | |||||||||||||||||||||||
|
| 2 | s.beginTransaction(); | |||||||||||||||||||||||
| 3 | Node parent = new Node("parent"); | ||||||||||||||||||||||||
3 | Transaction tx = s.beginTransaction(); |
| | |||||||||||||||||||||||
| 4 | Node child = new Node("child"); | ||||||||||||||||||||||||
4 | VersionedEntity root = new VersionedEntity("root", "root"); | | ||||||||||||||||||||||||
| 5 | parent.getCascadingChildren().add(child); | ||||||||||||||||||||||||
5 | VersionedEntity child = new VersionedEntity("c1", "child-1"); | | ||||||||||||||||||||||||
6 | root.getChildren().add(child); | | ||||||||||||||||||||||||
7 | child.setParent(root); | | ||||||||||||||||||||||||
8 | s.save(root); |
| | |||||||||||||||||||||||
9 | tx.commit(); |
| 7 | s.getTransaction().commit(); | ||||||||||||||||||||||
10 | s.close(); | 8 | s.close(); | |||||||||||||||||||||||
11 | assertInsertCount(2); |
| 9 | clearCounts(); | ||||||||||||||||||||||
| 11 | s.beginTransaction(); | ||||||||||||||||||||||||
|
| 12 | parent = (Node)s.get(Node.class, "parent"); | |||||||||||||||||||||||
12 | assertUpdateCount(0); | 16 | assertUpdateCount(0); | |||||||||||||||||||||||
13 | assertDeleteCount(0); | | ||||||||||||||||||||||||
14 | s = openSession(); | 10 | s = openSession(); | |||||||||||||||||||||||
15 | tx = s.beginTransaction(); |
| | |||||||||||||||||||||||
16 | s.delete(root); |
| 13 | s.delete(parent); | ||||||||||||||||||||||
17 | tx.commit(); |
| 14 | s.getTransaction().commit(); | ||||||||||||||||||||||
18 | s.close(); | 15 | s.close(); | |||||||||||||||||||||||
19 | assertUpdateCount(0); |
| 17 | assertInsertCount(0); | ||||||||||||||||||||||
20 | assertDeleteCount(2); | 18 | assertDeleteCount(2); |
Row | Violation |
---|---|
1 | Expression s.persist(parent) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression clearCounts() is a void method call, and thus it cannot be parameterized |
3 | Expression s.persist(parent) is a void method call, and thus it cannot be parameterized |
4 | Expression s.persist(parent) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression clearCounts() is a void method call, and thus it cannot be parameterized |
6 | Expression s.persist(parent) is a void method call, and thus it cannot be parameterized |
7 | Unmatched statement s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement Transaction tx=s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement s.save(root); cannot be moved before or after the extracted code, 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 | Expression assertInsertCount(2) is a void method call, and thus it cannot be parameterized |
12 | Expression clearCounts() is a void method call, and thus it cannot be parameterized |
13 | Expression assertInsertCount(2) is a void method call, and thus it cannot be parameterized |
14 | Expression clearCounts() is a void method call, and thus it cannot be parameterized |
15 | Unmatched statement parent=(Node)s.get(Node.class,"parent"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched statement tx=s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
17 | Type org.hibernate.test.ops.VersionedEntity of variable root does not match with type org.hibernate.test.ops.Node of variable parent |
18 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression assertUpdateCount(0) is a void method call, and thus it cannot be parameterized |
20 | Expression assertInsertCount(0) is a void method call, and thus it cannot be parameterized |