if ( reassociateIfUninitializedProxy( object, source ) ) { log.trace( "reassociated uninitialized proxy" ); // an uninitialized proxy, noop, don't even need to // return an id, since it is never a save() } else { //initialize properties of the event: final Object entity = source.getPersistenceContext().unproxyAndReassociate( object ); event.setEntity( entity ); event.setEntry( source.getPersistenceContext().getEntry( entity ) ); //return the id in the event object event.setResultId( performSaveOrUpdate( event ) ); }
PersistentClass model = (PersistentClass) classes.next(); if ( !model.isInherited() ) { IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator( settings.getDialect(), settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), (RootClass) model ); identifierGenerators.put( model.getEntityName(), generator ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultSaveOrUpdateEventListener.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
Method name: void onSaveOrUpdate(SaveOrUpdateEvent) Method name: void SessionFactoryImpl(Configuration, Mapping, Settings, EventListeners, SessionFactoryObserver)
Number of AST nodes: 6 Number of AST nodes: 4
1
if ( reassociateIfUninitializedProxy( object, source ) ) {
2
			log.trace( "reassociated uninitialized proxy" );
3
			// an uninitialized proxy, noop, don't even need to
4
			// return an id, since it is never a save()
5
		}
6
		else
1
PersistentClass model = (PersistentClass) classes.next();
7
 {
2
			if ( !model.isInherited() ) {
8
			//initialize properties of the event:
3
				
9
			final Object entity = source.getPersistenceContext().unproxyAndReassociate( object );
10
			event.setEntity( entity );
11
			event.setEntry( source.getPersistenceContext().getEntry( entity ) );
12
			//return the id in the event object
13
			event.setResultId( performSaveOrUpdate( event )
4
IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(
5
						settings.getDialect(),
6
				        settings.getDefaultCatalogName(),
7
				        settings.getDefaultSchemaName(),
8
				        (RootClass) model
9
					);
14
 );
10
				identifierGenerators.put( model.getEntityName(), generator );
15
		}
11
			}
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
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)153.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                        
    19
    PersistentClass model = (PersistentClass)classes.next();
    Preondition Violations
    Unmatched statement PersistentClass model=(PersistentClass)classes.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    PersistentClass model = (PersistentClass)classes.next();
    7
    if (reassociateIfUninitializedProxy(object, source))
    7
    if (reassociateIfUninitializedProxy(object, source))
    20
    if (!model.isInherited())
    Differences
    Expression1Expression2Difference
    reassociateIfUninitializedProxy(object,source)!model.isInherited()TYPE_COMPATIBLE_REPLACEMENT
    20
    if (!model.isInherited())
    8
    log.trace("reassociated uninitialized proxy");
                                                                                                      
    else
            
    9
    final Object entity = source.getPersistenceContext().unproxyAndReassociate(object);
    9
    final Object entity = source.getPersistenceContext().unproxyAndReassociate(object);
    Preondition Violations
    Unmatched statement final Object entity=source.getPersistenceContext().unproxyAndReassociate(object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                            
    10
    event.setEntity(entity);
                                                            
    11
    event.setEntry(source.getPersistenceContext().getEntry(entity));
                                                                                                                                            
    12
    event.setResultId(performSaveOrUpdate(event));
                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                          
    21
    IdentifierGenerator generator = model.getIdentifier().createIdentifierGenerator(settings.getDialect(), settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), (RootClass)model);
                                                                                                                                
    22
    identifierGenerators.put(model.getEntityName(), generator);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement PersistentClass model=(PersistentClass)classes.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement final Object entity=source.getPersistenceContext().unproxyAndReassociate(object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted