Element elem = (Element) elements.get(i); Object value = elementType.fromXMLNode( elem, persister.getFactory() ); Object copy = elementType.deepCopy( value, getSession().getEntityMode(), persister.getFactory() ); snapshot.put( getIndex(elem, indexNode, i), copy );
EntityPersister entityPersister = session.getFactory().getEntityPersister( getAssociatedEntityName() ); Object propertyValue = entityPersister.getPropertyValue( value, uniqueKeyPropertyName, session.getEntityMode() ); // We now have the value of the property-ref we reference. However, // we need to dig a little deeper, as that property might also be // an entity type, in which case we need to resolve its identitifier Type type = entityPersister.getPropertyType( uniqueKeyPropertyName ); if ( type.isEntityType() ) { propertyValue = ( ( EntityType ) type ).getIdentifier( propertyValue, session ); } return propertyValue;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentIndexedElementHolder.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/EntityType.java
Method name: Serializable getSnapshot(CollectionPersister) Method name: Object getIdentifier(Object, SessionImplementor)
Number of AST nodes: 4 Number of AST nodes: 6
1
Element elem = (Element) elements.get(i);
1
EntityPersister entityPersister = session.getFactory().getEntityPersister( getAssociatedEntityName() );
2
			Object value = elementType.fromXMLNode( elem, persister.getFactory() );
2
			Object 
3
			Object copy = elementType.deepCopy( value, getSession().getEntityMode(), persister.getFactory() );
4
			snapshot.put( getIndex(elem, indexNode, i), copy )
3
propertyValue = entityPersister.getPropertyValue( value, uniqueKeyPropertyName, session.getEntityMode() );
4
			// We now have the value of the property-ref we reference.  However,
5
			// we need to dig a little deeper, as that property might also be
6
			// an entity type, in which case we need to resolve its identitifier
7
			Type type = entityPersister.getPropertyType( uniqueKeyPropertyName );
8
			if ( type.isEntityType() ) {
9
				propertyValue = ( ( EntityType ) type ).getIdentifier( propertyValue, session );
10
			}
5
;
11
			return propertyValue;
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.0
Clones locationClones are in different classes
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements0
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeUnknown type
    Mapped Statements
    ID Statement ID Statement
    Precondition Violations (0)
    Row Violation