Source:
public void doSecondPass(Map persistentClasses) throws MappingException { PersistentClass referencedPersistentClass = (PersistentClass) persistentClasses.get( referencedEntityName ); if ( referencedPersistentClass == null ) { throw new AnnotationException( "Unknown entity name: " + referencedEntityName ); } if ( ! ( referencedPersistentClass.getIdentifier() instanceof Component ) ) { throw new AssertionFailure( "Unexpected identifier type on the referenced entity when mapping a @MapsId: " + referencedEntityName ); } Component referencedComponent = (Component) referencedPersistentClass.getIdentifier(); Iterator<Property> properties = referencedComponent.getPropertyIterator(); boolean isExplicitReference = true; Map<String, Ejb3JoinColumn> columnByReferencedName = new HashMap<>(joinColumns.length); for (Ejb3JoinColumn joinColumn : joinColumns) { final String referencedColumnName = joinColumn.getReferencedColumn(); if ( referencedColumnName == null || BinderHelper.isEmptyAnnotationValue( referencedColumnName ) ) { break; } columnByReferencedName.put( referencedColumnName.toLowerCase(Locale.ROOT), joinColumn ); } AtomicInteger index = new AtomicInteger( 0 ); if ( columnByReferencedName.isEmpty() ) { isExplicitReference = false; for ( Ejb3JoinColumn joinColumn : joinColumns ) { columnByReferencedName.put( "0", joinColumn ); index.getAndIncrement(); } index.set( 0 ); } while ( properties.hasNext() ) { Property referencedProperty = properties.next(); if ( referencedProperty.isComposite() ) { Property property = createComponentProperty( referencedPersistentClass, isExplicitReference, columnByReferencedName, index, referencedProperty ); component.addProperty( property ); } else { Property property = createSimpleProperty( referencedPersistentClass, isExplicitReference, columnByReferencedName, index, referencedProperty ); component.addProperty( property ); } } }

Target:
public void doSecondPass(Map persistentClasses) throws MappingException { PersistentClass referencedPersistentClass = (PersistentClass) persistentClasses.get( referencedEntityName ); if ( referencedPersistentClass == null ) { throw new AnnotationException( "Unknown entity name: " + referencedEntityName ); } if ( ! ( referencedPersistentClass.getIdentifier() instanceof Component ) ) { throw new AssertionFailure( "Unexpected identifier type on the referenced entity when mapping a @MapsId: " + referencedEntityName ); } Component referencedComponent = (Component) referencedPersistentClass.getIdentifier(); Iterator<Property> properties = referencedComponent.getPropertyIterator(); boolean isExplicitReference = true; Map<String, Ejb3JoinColumn> columnByReferencedName = new HashMap<>(joinColumns.length); for (Ejb3JoinColumn joinColumn : joinColumns) { final String referencedColumnName = joinColumn.getReferencedColumn(); if ( referencedColumnName == null || BinderHelper.isEmptyAnnotationValue( referencedColumnName ) ) { break; } columnByReferencedName.put( referencedColumnName.toLowerCase(Locale.ROOT), joinColumn ); } AtomicInteger index = new AtomicInteger( 0 ); if ( columnByReferencedName.isEmpty() ) { isExplicitReference = false; for ( Ejb3JoinColumn joinColumn : joinColumns ) { columnByReferencedName.put( String.valueOf( index.get() ), joinColumn ); index.getAndIncrement(); } index.set( 0 ); } while ( properties.hasNext() ) { Property referencedProperty = properties.next(); if ( referencedProperty.isComposite() ) { Property property = createComponentProperty( referencedPersistentClass, isExplicitReference, columnByReferencedName, index, referencedProperty ); component.addProperty( property ); } else { Property property = createSimpleProperty( referencedPersistentClass, isExplicitReference, columnByReferencedName, index, referencedProperty ); component.addProperty( property ); } } }