Program: 141467
Project: 141467
Buggy source:
/** 
 * Read an incoming   {@link CrateDocument} into the target entity.
 * @param entity the target entity.
 * @param source the document to convert.
 * @param parent an optional parent object.
 * @param < R > the entity type.
 * @return the converted entity.
 */
protected <R>R read(final CratePersistentEntity<R> entity,final CrateDocument source,final Object parent){
  final DefaultSpELExpressionEvaluator evaluator=new DefaultSpELExpressionEvaluator(source,spELContext);
  ParameterValueProvider<CratePersistentProperty> provider=getParameterProvider(entity,source,evaluator,parent);
  EntityInstantiator instantiator=instantiators.getInstantiatorFor(entity);
  R instance=instantiator.createInstance(entity,provider);
  final BeanWrapper<R> wrapper=create(instance,conversionService);
  final R result=wrapper.getBean();
  entity.doWithProperties(new PropertyHandler<CratePersistentProperty>(){
    @Override public void doWithPersistentProperty(    final CratePersistentProperty prop){
      if (!sourceHasProperty(prop) || entity.isConstructorArgument(prop)) {
        return;
      }
      wrapper.setProperty(prop,getValueInternal(prop,source,result));
    }
    private boolean sourceHasProperty(    final CratePersistentProperty property){
      return property.isIdProperty() || source.containsKey(property.getFieldName());
    }
  }
);
  entity.doWithAssociations(new AssociationHandler<CratePersistentProperty>(){
    @Override public void doWithAssociation(    final Association<CratePersistentProperty> association){
      CratePersistentProperty inverseProp=association.getInverse();
      Object obj=getValueInternal(inverseProp,source,result);
      wrapper.setProperty(inverseProp,obj);
    }
  }
);
  return result;
}

Fixed version (ground truth):
/** 
 * Read an incoming   {@link CrateDocument} into the target entity.
 * @param entity the target entity.
 * @param source the document to convert.
 * @param parent an optional parent object.
 * @param < R > the entity type.
 * @return the converted entity.
 */
protected <R>R read(final CratePersistentEntity<R> entity,final CrateDocument source,final Object parent){
  final DefaultSpELExpressionEvaluator evaluator=new DefaultSpELExpressionEvaluator(source,spELContext);
  ParameterValueProvider<CratePersistentProperty> provider=getParameterProvider(entity,source,evaluator,parent);
  EntityInstantiator instantiator=instantiators.getInstantiatorFor(entity);
  R instance=instantiator.createInstance(entity,provider);
  final BeanWrapper<R> wrapper=create(instance,conversionService);
  final R result=wrapper.getBean();
  final CratePersistentProperty idProperty=entity.getIdProperty();
  if (idProperty != null) {
    Object idValue=getValueInternal(idProperty,source,result);
    wrapper.setProperty(idProperty,idValue);
  }
  for (  CratePersistentProperty property : entity.getPersistentProperties()) {
    if (idProperty != null && idProperty.equals(property)) {
      continue;
    }
    if (!source.containsKey(property.getFieldName()) || entity.isConstructorArgument(property)) {
      continue;
    }
    wrapper.setProperty(property,getValueInternal(property,source,result));
  }
  entity.doWithAssociations(new AssociationHandler<CratePersistentProperty>(){
    @Override public void doWithAssociation(    final Association<CratePersistentProperty> association){
      CratePersistentProperty inverseProp=association.getInverse();
      Object obj=getValueInternal(inverseProp,source,result);
      wrapper.setProperty(inverseProp,obj);
    }
  }
);
  return result;
}