Session s = openSession(); Transaction t = s.beginTransaction(); try { s.createQuery( "update NonExistentEntity e set e.someProp = ?" ).executeUpdate(); fail( "no exception thrown" ); } catch( QueryException e ) { log.debug( "Caught expected error type : " + e.getMessage() ); } t.commit(); s.close();
Session s = openSession(); Transaction t = s.beginTransaction(); try { s.createQuery( "delete NonExistentEntity" ).executeUpdate(); fail( "no exception thrown" ); } catch( QueryException e ) { log.debug( "Caught expected error type : " + e.getMessage() ); } t.commit(); s.close();
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 testUpdateNonExistentEntity() Method name: void testDeleteNonExistentEntity()
Number of AST nodes: 7 Number of AST nodes: 7
1
Session s = openSession();
1
Session s = openSession();
2
		Transaction t = s.beginTransaction();
2
		Transaction t = s.beginTransaction();
3
		try {
3
		try {
4
			s.createQuery( "update NonExistentEntity e set e.someProp = ?" ).executeUpdate();
4
			s.createQuery( "delete NonExistentEntity" ).executeUpdate();
5
			fail( "no exception thrown" );
5
			fail( "no exception thrown" );
6
		}
6
		}
7
		catch( QueryException e ) {
7
		catch( QueryException e ) {
8
			log.debug( "Caught expected error type : " + e.getMessage() );
8
			log.debug( "Caught expected error type : " + e.getMessage() );
9
		}
9
		}
10
		t.commit();
10
		t.commit();
11
		s.close();
11
		s.close();
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.3
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Session s = openSession();
    1
    Session s = openSession();
    2
    Transaction t = s.beginTransaction();
    2
    Transaction t = s.beginTransaction();
    3
    try
    3
    try
    4
    s.createQuery("update NonExistentEntity e set e.someProp = ?").executeUpdate();
    4
    s.createQuery("update NonExistentEntity e set e.someProp = ?").executeUpdate();
    4
    s.createQuery("delete NonExistentEntity").executeUpdate();
    Differences
    Expression1Expression2Difference
    "update NonExistentEntity e set e.someProp = ?""delete NonExistentEntity"LITERAL_VALUE_MISMATCH
    4
    s.createQuery("delete NonExistentEntity").executeUpdate();
    5
    fail("no exception thrown");
    5
    fail("no exception thrown");
    6
    t.commit();
    6
    t.commit();
    7
    s.close();
    7
    s.close();
    Precondition Violations (0)
    Row Violation