File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/MultiTableTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/OneToOneCacheTest.java | |||
Method name: void testMultiTableNativeId()
|
Method name: void addObject2()
|
|||
Number of AST nodes: 9 | Number of AST nodes: 8 | |||
1 | Session s = openSession();↵ | 1 | Session session = openSession();↵ | |
2 | Transaction t = s.beginTransaction();↵ | 2 | Transaction tx = session.beginTransaction();↵ | |
3 | Multi multi = new Multi();↵ | 3 | M↵ | |
4 | multi.setExtraProp("extra"↵ | 4 | ainObject mo =↵ | |
5 | );↵ | 5 | ( MainObject ) session.load( MainObject.class, generatedId );↵ | |
6 | Long id = (Long) s.save(multi);↵ | 6 | ↵ | |
7 | assertTrue( id!=null↵ | 7 | Object2 toAdd = new Object2();↵ | |
8 | );↵ | 8 | toAdd.setDummy( "test" );↵ | |
9 | s.delete(multi↵ | 9 | //toAdd should now be saved by cascade↵ | |
10 | );↵ | 10 | mo.setObj2( toAdd );↵ | |
11 | t.commit();↵ | 11 | tx.commit();↵ | |
12 | s.close(); | 12 | session.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 | 54 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Session session = openSession(); | |||||||||||||||||||
1 | Session s = openSession(); | | |||||||||||||||||||
2 | Transaction t = s.beginTransaction(); |
| 2 | Transaction tx = session.beginTransaction(); | |||||||||||||||||
| 3 | MainObject mo = (MainObject)session.load(MainObject.class, generatedId); | |||||||||||||||||||
3 | Multi multi = new Multi(); | | |||||||||||||||||||
| 4 | Object2 toAdd = new Object2(); | |||||||||||||||||||
4 | multi.setExtraProp("extra"); | | |||||||||||||||||||
| 5 | toAdd.setDummy("test"); | |||||||||||||||||||
5 | Long id = (Long)s.save(multi); | | |||||||||||||||||||
| 6 | mo.setObj2(toAdd); | |||||||||||||||||||
6 | assertTrue(id != null); | | |||||||||||||||||||
7 | s.delete(multi); | | |||||||||||||||||||
8 | t.commit(); |
| 7 | tx.commit(); | |||||||||||||||||
9 | s.close(); |
| 8 | session.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.classic.Session of variable s does not match with type org.hibernate.Session of variable session |
2 | Type org.hibernate.classic.Session of variable s does not match with type org.hibernate.Session of variable session |