TestData data = new TestData(); data.prepare(); // These should only affect the given table Session s = openSession(); Transaction t = s.beginTransaction(); int count = s.createQuery( "delete Truck where owner = :owner" ).setString( "owner", "Steve" ).executeUpdate(); assertEquals( "incorrect restricted update count", 1, count ); count = s.createQuery( "delete Truck" ).executeUpdate(); assertEquals( "incorrect update count", 2, count ); t.commit(); s.close(); data.cleanup();
TestData data = new TestData(); data.prepare(); // These should only affect the given table Session s = openSession(); Transaction t = s.beginTransaction(); int count = s.createQuery( "delete Car where owner = :owner" ).setString( "owner", "Kirsten" ).executeUpdate(); assertEquals( "incorrect restricted update count", 1, count ); count = s.createQuery( "delete Car" ).executeUpdate(); assertEquals( "incorrect update count", 0, 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 testDeleteUnionSubclassConcreteSubclass() Method name: void testDeleteUnionSubclassLeafSubclass()
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 only affect the given table
3
		// These should only affect the given table
4
		Session s = openSession();
4
		Session s = openSession();
5
		Transaction t = s.beginTransaction();
5
		Transaction t = s.beginTransaction();
6
		int count = s.createQuery( "delete Truck where owner = :owner" ).setString( "owner", "Steve" ).executeUpdate();
6
		int count = s.createQuery( "delete Car where owner = :owner" ).setString( "owner", "Kirsten" ).executeUpdate();
7
		assertEquals( "incorrect restricted update count", 1, count );
7
		assertEquals( "incorrect restricted update count", 1, count );
8
		count = s.createQuery( "delete Truck" ).executeUpdate();
8
		count = s.createQuery( "delete Car" ).executeUpdate();
9
		assertEquals( "incorrect update count", 2, count );
9
		assertEquals( "incorrect update count", 0, count );
10
		t.commit();
10
		t.commit();
11
		s.close();
11
		s.close();
12
		data.cleanup();
12
		data.cleanup();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
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. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    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 Truck where owner = :owner").setString("owner", "Steve").executeUpdate();
    5
    int count = s.createQuery("delete Truck where owner = :owner").setString("owner", "Steve").executeUpdate();
    5
    int count = s.createQuery("delete Car where owner = :owner").setString("owner", "Kirsten").executeUpdate();
    Differences
    Expression1Expression2Difference
    "Steve""Kirsten"LITERAL_VALUE_MISMATCH
    "delete Truck where owner = :owner""delete Car where owner = :owner"LITERAL_VALUE_MISMATCH
    5
    int count = s.createQuery("delete Car where owner = :owner").setString("owner", "Kirsten").executeUpdate();
    6
    assertEquals("incorrect restricted update count", 1, count);
    6
    assertEquals("incorrect restricted update count", 1, count);
    7
    count = s.createQuery("delete Truck").executeUpdate();
    7
    count = s.createQuery("delete Truck").executeUpdate();
    7
    count = s.createQuery("delete Car").executeUpdate();
    Differences
    Expression1Expression2Difference
    "delete Truck""delete Car"LITERAL_VALUE_MISMATCH
    7
    count = s.createQuery("delete Car").executeUpdate();
    8
    assertEquals("incorrect update count", 2, count);
    8
    assertEquals("incorrect update count", 2, count);
    8
    assertEquals("incorrect update count", 0, count);
    Differences
    Expression1Expression2Difference
    20LITERAL_VALUE_MISMATCH
    8
    assertEquals("incorrect update count", 0, count);
    9
    t.commit();
    9
    t.commit();
    10
    s.close();
    10
    s.close();
    11
    data.cleanup();
    11
    data.cleanup();
    Precondition Violations (0)
    Row Violation