if ( map.isOneToMany() && !map.getKey().isNullable() && !map.isInverse() && !indexIsFormula ) { String entityName = ( (OneToMany) map.getElement() ).getReferencedEntityName(); PersistentClass referenced = mappings.getClass( entityName ); IndexBackref ib = new IndexBackref(); ib.setName( '_' + map.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" ); ib.setUpdateable( false ); ib.setSelectable( false ); ib.setCollectionRole( map.getRole() ); ib.setEntityName( map.getOwner().getEntityName() ); ib.setValue( map.getIndex() ); // ( (Column) ( (SimpleValue) ic.getIndex() ).getColumnIterator().next() // ).setNullable(false); referenced.addProperty( ib ); }
if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) { String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName(); PersistentClass referenced = mappings.getClass( entityName ); IndexBackref ib = new IndexBackref(); ib.setName( '_' + list.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" ); ib.setUpdateable( false ); ib.setSelectable( false ); ib.setCollectionRole( list.getRole() ); ib.setEntityName( list.getOwner().getEntityName() ); ib.setValue( list.getIndex() ); // ( (Column) ( (SimpleValue) ic.getIndex() ).getColumnIterator().next() // ).setNullable(false); referenced.addProperty( ib ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/HbmBinder.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/HbmBinder.java
Method name: void bindMapSecondPass(Element, Map, java.util.Map, Mappings, java.util.Map) Method name: void bindListSecondPass(Element, List, java.util.Map, Mappings, java.util.Map)
Number of AST nodes: 11 Number of AST nodes: 11
1
if ( map.isOneToMany() && !map.getKey().isNullable() && !map.isInverse() && !indexIsFormula ) {
1
if ( list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse() ) {
2
			String entityName = ( (OneToMany) map.getElement() ).getReferencedEntityName();
2
			String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
3
			PersistentClass referenced = mappings.getClass( entityName );
3
			PersistentClass referenced = mappings.getClass( entityName );
4
			IndexBackref ib = new IndexBackref();
4
			IndexBackref ib = new IndexBackref();
5
			ib.setName( '_' + map.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" );
5
			ib.setName( '_' + list.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" );
6
			ib.setUpdateable( false );
6
			ib.setUpdateable( false );
7
			ib.setSelectable( false );
7
			ib.setSelectable( false );
8
			ib.setCollectionRole( map.getRole() );
8
			ib.setCollectionRole( list.getRole() );
9
			ib.setEntityName( map.getOwner().getEntityName() );
9
			ib.setEntityName( list.getOwner().getEntityName() );
10
			ib.setValue( map.getIndex() );
10
			ib.setValue( list.getIndex() );
11
			// ( (Column) ( (SimpleValue) ic.getIndex() ).getColumnIterator().next()
11
			// ( (Column) ( (SimpleValue) ic.getIndex() ).getColumnIterator().next()
12
			// ).setNullable(false);
12
			// ).setNullable(false);
13
			referenced.addProperty( ib );
13
			referenced.addProperty( ib );
14
		}
14
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons121
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    30
    if (map.isOneToMany() && !map.getKey().isNullable() && !map.isInverse() && !indexIsFormula)
    30
    if (map.isOneToMany() && !map.getKey().isNullable() && !map.isInverse() && !indexIsFormula)
    13
    if (list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse())
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    map.isOneToMany() && !map.getKey().isNullable() && !map.isInverse()&& !indexIsFormulalist.isOneToMany() && !list.getKey().isNullable() && !list.isInverse()INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    13
    if (list.isOneToMany() && !list.getKey().isNullable() && !list.isInverse())
    31
    String entityName = ((OneToMany)map.getElement()).getReferencedEntityName();
    31
    String entityName = ((OneToMany)map.getElement()).getReferencedEntityName();
    14
    String entityName = ((OneToMany)list.getElement()).getReferencedEntityName();
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    14
    String entityName = ((OneToMany)list.getElement()).getReferencedEntityName();
    32
    PersistentClass referenced = mappings.getClass(entityName);
    15
    PersistentClass referenced = mappings.getClass(entityName);
    33
    IndexBackref ib = new IndexBackref();
    16
    IndexBackref ib = new IndexBackref();
    34
    ib.setName('_' + map.getOwnerEntityName() + "." + node.attributeValue("name") + "IndexBackref");
    34
    ib.setName('_' + map.getOwnerEntityName() + "." + node.attributeValue("name") + "IndexBackref");
    17
    ib.setName('_' + list.getOwnerEntityName() + "." + node.attributeValue("name") + "IndexBackref");
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    17
    ib.setName('_' + list.getOwnerEntityName() + "." + node.attributeValue("name") + "IndexBackref");
    35
    ib.setUpdateable(false);
    18
    ib.setUpdateable(false);
    36
    ib.setSelectable(false);
    19
    ib.setSelectable(false);
    37
    ib.setCollectionRole(map.getRole());
    37
    ib.setCollectionRole(map.getRole());
    20
    ib.setCollectionRole(list.getRole());
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    20
    ib.setCollectionRole(list.getRole());
    38
    ib.setEntityName(map.getOwner().getEntityName());
    38
    ib.setEntityName(map.getOwner().getEntityName());
    21
    ib.setEntityName(list.getOwner().getEntityName());
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    21
    ib.setEntityName(list.getOwner().getEntityName());
    39
    ib.setValue(map.getIndex());
    39
    ib.setValue(map.getIndex());
    22
    ib.setValue(list.getIndex());
    Differences
    Expression1Expression2Difference
    maplistVARIABLE_NAME_MISMATCH
    org.hibernate.mapping.Maporg.hibernate.mapping.ListSUBCLASS_TYPE_MISMATCH
    22
    ib.setValue(list.getIndex());
    40
    referenced.addProperty(ib);
    23
    referenced.addProperty(ib);
    Precondition Violations (0)
    Row Violation