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.1
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)9.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    generatedId = persister.insert(state, instance, session);
                                                                                                                    
    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);
                                                                                                                                                                        
                                                                                                          
    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()) 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()) 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);
    Precondition Violations (4)
    Row Violation
    1Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    2Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized
    3Expression persister.setIdentifier(instance,generatedId,session.getEntityMode()) is a void method call, and thus it cannot be parameterized
    4Expression persister.processInsertGeneratedProperties(id,instance,state,session) is a void method call, and thus it cannot be parameterized