@Override
  public Attribute create(
      ValidationMetaData validationMetaData,
      EntityType entityType,
      HibernateEntityTypeCreationContext ctx,
      PropertyDescriptor propertyDescriptor,
      Type attributeType,
      SessionFactoryImplementor sessionFactoryImplementor) {
    MapType mapType = (MapType) attributeType;
    Association association = propertyDescriptor.getAnnotation(Association.class);
    final MapAttributeImpl mapAssociationAttributeImpl = beanCreator.create(MapAttributeImpl.class);
    mapAssociationAttributeImpl.setAccessor(
        new HibernateAccessor(
            propertyDescriptor.getField(),
            propertyDescriptor.getReadMethod(),
            propertyDescriptor.getWriteMethod()));
    mapAssociationAttributeImpl.setCode(propertyDescriptor.getName());
    mapAssociationAttributeImpl.setEntityType(entityType);

    final String targeTypeName = mapType.getElementType(sessionFactoryImplementor).getName();
    final EntityType targetType = ctx.getEntityTypeReference(targeTypeName);
    mapAssociationAttributeImpl.setTargetType(targetType);
    MapKey jpaMapKey = propertyDescriptor.getAnnotation(MapKey.class);
    final String mapKeyPropertyName = jpaMapKey.name();

    ctx.addListener(
        new EntityTypeRepositoryListener() {
          @Override
          public void onEvent(PhaseEvent event) {
            if (event.getPhase() == Phase.ENTITY_TYPES_INITIALIZED) {
              final Attribute keyAttribute = targetType.getAttribute(mapKeyPropertyName);
              mapAssociationAttributeImpl.setKeyType(keyAttribute.getTargetType());
            }
          }
        });
    // TODO add subtypes here
    mapAssociationAttributeImpl.setWriteable(true);
    return mapAssociationAttributeImpl;
  }