private void onEmbeddable(Object entity, Class<?> clazz, MetamodelImpl metaModel,
            Map<String, Object> indexCollection)
    {
        Map<String, EmbeddableType> embeddables = metaModel.getEmbeddables(clazz);
        EntityType entityType = metaModel.entity(clazz);

        for (String embeddedFieldName : embeddables.keySet())
        {
            EmbeddableType embeddedColumn = embeddables.get(embeddedFieldName);

            // Index embeddable only when specified by user
            Field embeddedField = (Field) entityType.getAttribute(embeddedFieldName).getJavaMember();
            if (!MetadataUtils.isEmbeddedAtributeIndexable(embeddedField))
            {
                continue;
            }

            Object embeddedObject = PropertyAccessorHelper.getObject(entity,
                    (Field) entityType.getAttribute(embeddedFieldName).getJavaMember());
            if (embeddedObject != null && !(embeddedObject instanceof Collection))
            {
                for (Object column : embeddedColumn.getAttributes())
                {
                    Attribute columnAttribute = (Attribute) column;
                    String columnName = columnAttribute.getName();
                    Class<?> columnClass = ((AbstractAttribute) columnAttribute).getBindableJavaType();
                    if (MetadataUtils.isColumnInEmbeddableIndexable(embeddedField, columnName))
                    {
                        indexCollection.put(
                                embeddedField.getName() + "." + columnName,
                                PropertyAccessorHelper.getObject(embeddedObject,
                                        (Field) columnAttribute.getJavaMember()));
                    }
                }
            }

        }
    }
private void onEmbeddable ( Object entity , Class < ? > clazz , MetamodelImpl metaModel , Map < String , Object > indexCollection ) { Map < String , EmbeddableType > embeddables = metaModel . getEmbeddables ( clazz ) ; EntityType entityType = metaModel . entity ( clazz ) ; for ( String embeddedFieldName : embeddables . keySet ( ) ) { EmbeddableType embeddedColumn = embeddables . get ( embeddedFieldName ) ; Field embeddedField = ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ; if ( ! MetadataUtils . isEmbeddedAtributeIndexable ( embeddedField ) ) { continue ; } Object embeddedObject = PropertyAccessorHelper . getObject ( entity , ( Field ) entityType . getAttribute ( embeddedFieldName ) . getJavaMember ( ) ) ; if ( embeddedObject != null && ! ( embeddedObject instanceof Collection ) ) { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; String columnName = columnAttribute . getName ( ) ; Class < ? > columnClass = ( ( AbstractAttribute ) columnAttribute ) . getBindableJavaType ( ) ; if ( MetadataUtils . isColumnInEmbeddableIndexable ( embeddedField , columnName ) ) { indexCollection . put ( embeddedField . getName ( ) + "." + columnName , PropertyAccessorHelper . getObject ( embeddedObject , ( Field ) columnAttribute . getJavaMember ( ) ) ) ; } } } } }
@param entity
@param clazz
@param metaModel
@param indexCollection