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 | 9 |
Number of unmapped statements in the first code fragment | 11 |
Number of unmapped statements in the second code fragment | 9 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | clearCounts(); | 9 | clearCounts(); | |||||||||||||||
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 | s.persist(parent); | |||||||||||||||
6 | root.getChildren().add(child); | | ||||||||||||||||
|
| 7 | s.getTransaction().commit(); | |||||||||||||||
7 | child.setParent(root); |
| | |||||||||||||||
8 | s.save(root); |
| | |||||||||||||||
9 | tx.commit(); |
| | |||||||||||||||
10 | s.close(); | 8 | s.close(); | |||||||||||||||
|
| 11 | s.beginTransaction(); | |||||||||||||||
|
| 12 | parent = (Node)s.get(Node.class, "parent"); | |||||||||||||||
11 | assertInsertCount(2); |
| 17 | assertInsertCount(0); | ||||||||||||||
12 | assertUpdateCount(0); | | ||||||||||||||||
13 | assertDeleteCount(0); | | ||||||||||||||||
14 | s = openSession(); | 10 | s = openSession(); | |||||||||||||||
15 | tx = s.beginTransaction(); |
| | |||||||||||||||
16 | s.delete(root); |
| 13 | s.delete(parent); | ||||||||||||||
|
| 14 | s.getTransaction().commit(); | |||||||||||||||
17 | tx.commit(); |
| | |||||||||||||||
18 | s.close(); | 15 | s.close(); | |||||||||||||||
19 | assertUpdateCount(0); | 16 | assertUpdateCount(0); | |||||||||||||||
20 | assertDeleteCount(2); | 18 | assertDeleteCount(2); |
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 Node parent=new Node("parent"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | 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 |
4 | Unmatched statement Node child=new Node("child"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement VersionedEntity root=new VersionedEntity("root","root"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement VersionedEntity child=new VersionedEntity("c1","child-1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Unmatched statement s.persist(parent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | 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 |
9 | Unmatched statement child.setParent(root); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
10 | 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 |
11 | Unmatched statement tx.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
12 | Unmatched statement s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | 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 |
14 | 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 |
15 | Type org.hibernate.test.ops.VersionedEntity of variable root does not match with type org.hibernate.test.ops.Node of variable parent |
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 | Unmatched statement tx.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |