Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ) .addColumns( keyColumnNames ); if ( hasIndex && !indexContainsFormula ) update.addColumns( indexColumnNames ); //identifier collections not supported for 1-to-many if ( getFactory().getSettings().isCommentsEnabled() ) { update.setComment( "create one-to-many row " + getRole() ); } return update.setPrimaryKeyColumnNames( elementColumnNames ) .toStatementString();
Delete delete = new Delete() .setTableName( getTableName( j ) ) .setPrimaryKeyColumnNames( getKeyColumns( j ) ); if ( j == 0 ) { delete.setVersionColumnName( getVersionColumnName() ); } if ( getFactory().getSettings().isCommentsEnabled() ) { delete.setComment( "delete " + getEntityName() ); } return delete.toStatementString();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
Method name: String generateInsertRowString() Method name: String generateDeleteString(int)
Number of AST nodes: 6 Number of AST nodes: 6
1
Update update = new Update( getDialect() )
1
Delete delete = new Delete()
2
				.setTableName( qualifiedTableName )
2
				.setTableName( getTableName( j ) )
3
				.addColumns( keyColumnNames );
3
				.
4
		
5
		if ( hasIndex && !indexContainsFormula ) update.addColumns( index
4
setPrimaryKeyColumnNames( getKeyColumns( j ) );
5
		if ( j == 0 ) {
6
ColumnNames );
6
			delete.setVersionColumnName( getVersionColumnName() );
7
		
7
		
8
		//identifier collections not supported for 1-to-many
8
}
9
		if ( getFactory().getSettings().isCommentsEnabled() ) {
9
		if ( getFactory().getSettings().isCommentsEnabled() ) {
10
			update.setComment( "create one-to-many row " + getRole() );
10
			delete.setComment( "delete " + getEntityName() );
11
		}
11
		}
12
		
12
		
13
		return update.setPrimaryKeyColumnNames( elementColumnNames )
13
return 
14
				.toStatementString();
14
delete.toStatementString();
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.6
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)41.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                                                  
    1
    Delete delete = new Delete().setTableName(getTableName(j)).setPrimaryKeyColumnNames(getKeyColumns(j));
    1
    Update update = new Update(getDialect()).setTableName(qualifiedTableName).addColumns(keyColumnNames);
                                                                                                                                                                                                                
    4
    if (getFactory().getSettings().isCommentsEnabled())
    4
    if (getFactory().getSettings().isCommentsEnabled())
                                                                                                        
    5
    delete.setComment("delete " + getEntityName());
    Preondition Violations
    Unmatched statement delete.setComment("delete " + getEntityName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    delete.setComment("delete " + getEntityName());
    5
    update.setComment("create one-to-many row " + getRole());
    5
    update.setComment("create one-to-many row " + getRole());
    Preondition Violations
    Unmatched statement update.setComment("create one-to-many row " + getRole()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                            
    Precondition Violations (3)
    Row Violation
    1Unmatched statement delete.setComment("delete " + getEntityName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement update.setComment("create one-to-many row " + getRole()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero