TestData data = new TestData(); data.prepare(); Session s = openSession(); Transaction t = s.beginTransaction(); int count = s.createQuery( "update Mammal set bodyWeight = null" ).executeUpdate(); assertEquals( "Incorrect deletion count on joined subclass", 2, count ); count = s.createQuery( "delete Animal where bodyWeight = null" ).executeUpdate(); assertEquals( "Incorrect deletion count on joined subclass", 2, count ); t.commit(); s.close(); data.cleanup();
TestData data = new TestData(); data.prepare(); // These should reach out into *all* subclass tables... Session s = openSession(); Transaction t = s.beginTransaction(); int count = s.createQuery( "delete Vehicle where owner = :owner" ).setString( "owner", "Steve" ).executeUpdate(); assertEquals( "incorrect restricted update count", 1, count ); count = s.createQuery( "delete Vehicle" ).executeUpdate(); assertEquals( "incorrect update count", 3, count ); t.commit(); s.close(); data.cleanup();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/BulkManipulationTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/BulkManipulationTest.java
Method name: void testUpdateSetNullOnJoinedSubclass() Method name: void testDeleteUnionSubclassAbstractRoot()
Number of AST nodes: 11 Number of AST nodes: 11
1
TestData data = new TestData();
1
TestData data = new TestData();
2
		data.prepare();
2
		data.prepare();
3
		// These should reach out into *all* subclass tables...
3
		Session s = openSession();
4
		Session s = openSession();
4
		Transaction t = s.beginTransaction();
5
		Transaction t = s.beginTransaction();
5
		int count = s.createQuery( "update Mammal set bodyWeight = null" ).executeUpdate();
6
		int count = s.createQuery( "delete Vehicle where owner = :owner" ).setString( "owner", "Steve" ).executeUpdate();
6
		assertEquals( "Incorrect deletion count on joined subclass", 2, count );
7
		assertEquals( "incorrect restricted update count", 1, count );
7
		count = s.createQuery( "delete Animal where bodyWeight = null" ).executeUpdate();
8
		count = s.createQuery( "delete Vehicle" ).executeUpdate();
8
		assertEquals( "Incorrect deletion count on joined subclass", 2, count );
9
		assertEquals( "incorrect update count", 3, count );
9
		t.commit();
10
		t.commit();
10
		s.close();
11
		s.close();
11
		data.cleanup();
12
		data.cleanup();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    TestData data = new TestData();
    1
    TestData data = new TestData();
    2
    data.prepare();
    2
    data.prepare();
    3
    Session s = openSession();
    3
    Session s = openSession();
    4
    Transaction t = s.beginTransaction();
    4
    Transaction t = s.beginTransaction();
                                                                                                                                                                                                                              
    5
    int count = s.createQuery("delete Vehicle where owner = :owner").setString("owner", "Steve").executeUpdate();
    Preondition Violations
    Unmatched statement int count=s.createQuery("delete Vehicle where owner = :owner").setString("owner","Steve").executeUpdate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    int count = s.createQuery("delete Vehicle where owner = :owner").setString("owner", "Steve").executeUpdate();
    5
    int count = s.createQuery("update Mammal set bodyWeight = null").executeUpdate();
    5
    int count = s.createQuery("update Mammal set bodyWeight = null").executeUpdate();
    Preondition Violations
    Unmatched statement int count=s.createQuery("update Mammal set bodyWeight = null").executeUpdate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                        
    6
    assertEquals("Incorrect deletion count on joined subclass", 2, count);
    6
    assertEquals("Incorrect deletion count on joined subclass", 2, count);
    6
    assertEquals("incorrect restricted update count", 1, count);
    Differences
    Expression1Expression2Difference
    "Incorrect deletion count on joined subclass""incorrect restricted update count"LITERAL_VALUE_MISMATCH
    21LITERAL_VALUE_MISMATCH
    6
    assertEquals("incorrect restricted update count", 1, count);
    7
    count = s.createQuery("delete Animal where bodyWeight = null").executeUpdate();
    7
    count = s.createQuery("delete Animal where bodyWeight = null").executeUpdate();
    7
    count = s.createQuery("delete Vehicle").executeUpdate();
    Differences
    Expression1Expression2Difference
    "delete Animal where bodyWeight = null""delete Vehicle"LITERAL_VALUE_MISMATCH
    7
    count = s.createQuery("delete Vehicle").executeUpdate();
    8
    assertEquals("Incorrect deletion count on joined subclass", 2, count);
    8
    assertEquals("Incorrect deletion count on joined subclass", 2, count);
    8
    assertEquals("incorrect update count", 3, count);
    Differences
    Expression1Expression2Difference
    "Incorrect deletion count on joined subclass""incorrect update count"LITERAL_VALUE_MISMATCH
    23LITERAL_VALUE_MISMATCH
    8
    assertEquals("incorrect update count", 3, count);
    9
    t.commit();
    9
    t.commit();
    10
    s.close();
    10
    s.close();
    11
    data.cleanup();
    11
    data.cleanup();
    Precondition Violations (2)
    Row Violation
    1Unmatched statement int count=s.createQuery("delete Vehicle where owner = :owner").setString("owner","Steve").executeUpdate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement int count=s.createQuery("update Mammal set bodyWeight = null").executeUpdate(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted