final Serializable id = session.getEntityPersister( entityName, obj ) //TODO: cache the persister, this shows up in yourkit .getIdentifier( obj, session.getEntityMode() ); if (id==null) { throw new IdentifierGenerationException( "ids for this class must be manually assigned before calling save(): " + entityName ); } return id;
Object id = getIdentifierType().nullSafeGet( rs, alias, session, null ); if ( id == null ) { throw new HibernateException( "null identifier column for collection: " + role ); } return id;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/Assigned.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
Method name: Serializable generate(SessionImplementor, Object) Method name: Object readIdentifier(ResultSet, String, SessionImplementor)
Number of AST nodes: 4 Number of AST nodes: 4
1
final Serializable id = session.getEntityPersister( entityName, obj ) 
2
				//TODO: cache the persister, this shows up in yourkit
3
				.getIdentifier( obj, session.getEntityMode() );
4
		
1
Object id = getIdentifierType().nullSafeGet( rs, alias, session, null );
5
		if (id==null) {
2
		if ( id == null ) {
6
			throw new IdentifierGenerationException(
3
			throw new 
7
				"ids for this class must be manually assigned before calling save(): " + 
4
HibernateException( "null identifier column for coll
8
				entityName
9
			);
5
ection: " + role );
10
		}
6
		}
11
		
7
		
12
		return id;
8
return id;
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 comparisons8
  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)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                            
    1
    Object id = getIdentifierType().nullSafeGet(rs, alias, session, null);
    1
    final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode());
    1
    final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode());
    Preondition Violations
    Unmatched statement final Serializable id=session.getEntityPersister(entityName,obj).getIdentifier(obj,session.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                  
    2
    if (id == null)
    2
    if (id == null)
    2
    if (id == null)
    Differences
    Expression1Expression2Difference
    java.io.Serializablejava.lang.ObjectVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.Serializable of variable id does not match with type java.lang.Object of variable id
    • Make classes java.io.Serializable and java.lang.Object extend a common superclass
    2
    if (id == null)
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    3
    throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
    3
    throw new HibernateException("null identifier column for collection: " + role);
    Differences
    Expression1Expression2Difference
    org.hibernate.id.IdentifierGenerationExceptionorg.hibernate.HibernateExceptionSUBCLASS_TYPE_MISMATCH
    "ids for this class must be manually assigned before calling save(): ""null identifier column for collection: "LITERAL_VALUE_MISMATCH
    entityNameroleVARIABLE_NAME_MISMATCH
    3
    throw new HibernateException("null identifier column for collection: " + role);
                              
    4
    return id;
    Preondition Violations
    Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return id;
    4
    return id;
    4
    return id;
    4
    return id;
    Preondition Violations
    Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return id;
                              
    Precondition Violations (7)
    Row Violation
    1Unmatched statement final Serializable id=session.getEntityPersister(entityName,obj).getIdentifier(obj,session.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type java.io.Serializable of variable id does not match with type java.lang.Object of variable id
    3Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return id;
    5Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return id;
    7The refactoring of the clones is infeasible, because classes org.hibernate.id.Assigned and org.hibernate.persister.collection.AbstractCollectionPersister do not have a common superclass