File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/entitymode/multi/MultiRepresentationTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/BulkManipulationTest.java | |||
Method name: void testPojoRetreival()
|
Method name: void testDeleteRestrictedOnManyToOne()
|
|||
Number of AST nodes: 9 | Number of AST nodes: 9 | |||
1 | TestData testData = new TestData();↵ | 1 | TestData data = new TestData();↵ | |
2 | testData.create();↵ | 2 | data.prepare();↵ | |
3 | Session session = openSession();↵ | 3 | Session s = openSession();↵ | |
4 | Transaction txn = session.beginTransaction();↵ | 4 | Transaction t = s.beginTransaction();↵ | |
5 | Stock stock = ( Stock ) session.get( Stock.class, new Long( 1 ) );↵ | 5 | ↵ | |
6 | assertEquals( "Something wrong!", new Long( 1 ), stock.getId()↵ | 6 | int count = s.createQuery( "delete Animal where mother = :mother" )↵ | |
7 | .setEntity( "mother", data.butterfly )↵ | |||
8 | .executeUpdate();↵ | |||
7 | );↵ | 9 | assertEquals( 1, count );↵ | |
8 | txn.commit();↵ | 10 | t.commit();↵ | |
9 | session.close();↵ | 11 | s.close();↵ | |
10 | testData.destroy(); | 12 | data.cleanup(); | |
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 | 61 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | TestData data = new TestData(); | ||||||||||||||||||||||
1 | TestData testData = new TestData(); | | ||||||||||||||||||||||
| 2 | data.prepare(); | ||||||||||||||||||||||
2 | testData.create(); |
| 6 | assertEquals(1, count); | ||||||||||||||||||||
3 | Session session = openSession(); |
| 3 | Session s = openSession(); | ||||||||||||||||||||
4 | Transaction txn = session.beginTransaction(); |
| 4 | Transaction t = s.beginTransaction(); | ||||||||||||||||||||
|
| 5 | int count = s.createQuery("delete Animal where mother = :mother").setEntity("mother", data.butterfly).executeUpdate(); | |||||||||||||||||||||
5 | Stock stock = (Stock)session.get(Stock.class, new Long(1)); |
| | |||||||||||||||||||||
6 | assertEquals("Something wrong!", new Long(1), stock.getId()); |
| 9 | data.cleanup(); | ||||||||||||||||||||
7 | txn.commit(); |
| 7 | t.commit(); | ||||||||||||||||||||
8 | session.close(); |
| 8 | s.close(); | ||||||||||||||||||||
9 | testData.destroy(); | |
Row | Violation |
---|---|
1 | Expression testData.create() is a void method call, and thus it cannot be parameterized |
2 | Expression assertEquals(1,count) is a void method call, and thus it cannot be parameterized |
3 | Expression testData.create() is a void method call, and thus it cannot be parameterized |
4 | Expression assertEquals(1,count) is a void method call, and thus it cannot be parameterized |
5 | Unmatched statement int count=s.createQuery("delete Animal where mother = :mother").setEntity("mother",data.butterfly).executeUpdate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement Stock stock=(Stock)session.get(Stock.class,new Long(1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Expression assertEquals("Something wrong!",new Long(1),stock.getId()) is a void method call, and thus it cannot be parameterized |
8 | Expression data.cleanup() is a void method call, and thus it cannot be parameterized |
9 | Expression assertEquals("Something wrong!",new Long(1),stock.getId()) is a void method call, and thus it cannot be parameterized |
10 | Expression data.cleanup() is a void method call, and thus it cannot be parameterized |