generatedId = persister.insert( state, instance, session ); if ( persister.hasInsertGeneratedProperties() ) { persister.processInsertGeneratedProperties( generatedId, instance, state, session ); } //need to do that here rather than in the save event listener to let //the post insert events to have a id-filled entity when IDENTITY is used (EJB3) persister.setIdentifier( instance, generatedId, session.getEntityMode() );
if ( persister.hasInsertGeneratedProperties() ) { persister.processInsertGeneratedProperties( id, instance, state, session ); if ( persister.isVersionPropertyGenerated() ) { version = Versioning.getVersion(state, persister); } entry.postUpdate(instance, state, version); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/EntityIdentityInsertAction.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/EntityInsertAction.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 4 Number of AST nodes: 5
1
generatedId = persister.insert( state, instance, session );
2
			if ( persister.hasInsertGeneratedProperties() ) {
1
if ( persister.hasInsertGeneratedProperties() ) {
3
				persister.processInsertGeneratedProperties( generatedId, instance, state, session );
2
				persister.processInsertGeneratedProperties( id, instance, state, session );
4
			}
3
			
5
			//need to do that here rather than in the save event listener to let
6
			//the post insert events to have a id-filled entity when IDENTITY is used (EJB3)
7
			persister.setIdentifier( instance, generatedId, session.getEntityMode() );
4
	if ( persister.isVersionPropertyGenerated() ) {
5
					version = Versioning.getVersion(state, persister);
6
				}
7
				entry.postUpdate(instance, state, version);
8
			}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)27.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    generatedId = persister.insert(state, instance, session);
    6
    generatedId = persister.insert(state, instance, session);
    Preondition Violations
    Unmatched statement generatedId=persister.insert(state,instance,session); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                    
    7
    if (persister.hasInsertGeneratedProperties())
    7
    if (persister.hasInsertGeneratedProperties())
    14
    if (persister.isVersionPropertyGenerated())
    Differences
    Expression1Expression2Difference
    hasInsertGeneratedPropertiesisVersionPropertyGeneratedMETHOD_INVOCATION_NAME_MISMATCH
    14
    if (persister.isVersionPropertyGenerated())
    8
    persister.processInsertGeneratedProperties(generatedId, instance, state, session);
    8
    persister.processInsertGeneratedProperties(generatedId, instance, state, session);
    Preondition Violations
    Unmatched statement persister.processInsertGeneratedProperties(generatedId,instance,state,session); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                        
                                                                                                          
    15
    version = Versioning.getVersion(state, persister);
    Preondition Violations
    Unmatched statement version=Versioning.getVersion(state,persister); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    15
    version = Versioning.getVersion(state, persister);
    9
    persister.setIdentifier(instance, generatedId, session.getEntityMode());
    9
    persister.setIdentifier(instance, generatedId, session.getEntityMode());
    13
    persister.processInsertGeneratedProperties(id, instance, state, session);
    Differences
    Expression1Expression2Difference
    setIdentifierprocessInsertGeneratedPropertiesMETHOD_INVOCATION_NAME_MISMATCH
    persister.setIdentifier(instance,generatedId,session.getEntityMode())persister.processInsertGeneratedProperties(id,instance,state,session)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized
    Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized
    13
    persister.processInsertGeneratedProperties(id, instance, state, session);
                                                                                              
    16
    entry.postUpdate(instance, state, version);
    Preondition Violations
    Unmatched statement entry.postUpdate(instance,state,version); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    16
    entry.postUpdate(instance, state, version);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement generatedId=persister.insert(state,instance,session); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement persister.processInsertGeneratedProperties(generatedId,instance,state,session); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement version=Versioning.getVersion(state,persister); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    6Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized
    7Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    9Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized
    10Unmatched statement entry.postUpdate(instance,state,version); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted