Program: 176180
Project: 176180
Buggy source:
/** 
 * Wraps entity attributes into byte[] and return instance of attribute wrapper.
 * @param entityMetadata
 * @param entity
 * @return
 */
private AttributeWrapper wrap(EntityMetadata entityMetadata,Object entity){
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(entityMetadata.getPersistenceUnit());
  EntityType entityType=metaModel.entity(entityMetadata.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  AttributeWrapper wrapper=new AttributeWrapper(attributes.size());
  List<String> relationNames=entityMetadata.getRelationNames();
  for (  Attribute attr : attributes) {
    if (!entityMetadata.getIdAttribute().equals(attr) && !attr.isAssociation()) {
      if (metaModel.isEmbeddable(((AbstractAttribute)attr).getBindableJavaType())) {
        EmbeddableType embeddableAttribute=metaModel.embeddable(((AbstractAttribute)attr).getBindableJavaType());
        Object embeddedObject=PropertyAccessorHelper.getObject(entity,(Field)attr.getJavaMember());
        Set<Attribute> embeddedAttributes=embeddableAttribute.getAttributes();
        for (        Attribute attrib : embeddedAttributes) {
          addToWrapper(entityMetadata,wrapper,embeddedObject,attrib,attr);
        }
      }
 else {
        addToWrapper(entityMetadata,wrapper,entity,attr);
      }
    }
 else     if (attributes.size() == 1) {
      byte[] value=PropertyAccessorHelper.get(entity,(Field)attr.getJavaMember());
      byte[] name;
      name=getEncodedBytes(((AbstractAttribute)attr).getJPAColumnName());
      wrapper.addColumn(name,value);
    }
  }
  return wrapper;
}

Fixed version (ground truth):
/** 
 * Wraps entity attributes into byte[] and return instance of attribute wrapper.
 * @param entityMetadata
 * @param entity
 * @return
 */
private AttributeWrapper wrap(EntityMetadata entityMetadata,Object entity){
  MetamodelImpl metaModel=(MetamodelImpl)KunderaMetadata.INSTANCE.getApplicationMetadata().getMetamodel(entityMetadata.getPersistenceUnit());
  EntityType entityType=metaModel.entity(entityMetadata.getEntityClazz());
  Set<Attribute> attributes=entityType.getAttributes();
  AttributeWrapper wrapper=new AttributeWrapper(attributes.size());
  List<String> relationNames=entityMetadata.getRelationNames();
  for (  Attribute attr : attributes) {
    if (!attr.isAssociation()) {
      if (metaModel.isEmbeddable(((AbstractAttribute)attr).getBindableJavaType())) {
        EmbeddableType embeddableAttribute=metaModel.embeddable(((AbstractAttribute)attr).getBindableJavaType());
        Object embeddedObject=PropertyAccessorHelper.getObject(entity,(Field)attr.getJavaMember());
        Set<Attribute> embeddedAttributes=embeddableAttribute.getAttributes();
        for (        Attribute attrib : embeddedAttributes) {
          addToWrapper(entityMetadata,wrapper,embeddedObject,attrib,attr);
        }
      }
 else {
        addToWrapper(entityMetadata,wrapper,entity,attr);
      }
    }
 else     if (attributes.size() == 1) {
      byte[] value=PropertyAccessorHelper.get(entity,(Field)attr.getJavaMember());
      byte[] name;
      name=getEncodedBytes(((AbstractAttribute)attr).getJPAColumnName());
      wrapper.addColumn(name,value);
    }
  }
  return wrapper;
}