private void buildEmbeddedValue(final Object record, MetamodelImpl metaModel, StringBuilder embeddedValueBuilder,
            SingularAttribute attribute)
    {
        // TODO Auto-generated method stub
        Field field = (Field) attribute.getJavaMember();

        EmbeddableType embeddableKey = metaModel.embeddable(field.getType());
        Object embeddableKeyObj = PropertyAccessorHelper.getObject(record, field);
        if (embeddableKeyObj != null)
        {
            StringBuilder tempBuilder = new StringBuilder();
            tempBuilder.append(Constants.OPEN_CURLY_BRACKET);

            for (Field embeddableColumn : field.getType().getDeclaredFields())
            {
                if (!ReflectUtils.isTransientOrStatic(embeddableColumn))
                {
                    Attribute subAttribute = (SingularAttribute) embeddableKey.getAttribute(embeddableColumn.getName());
                    if (metaModel.isEmbeddable(((AbstractAttribute) subAttribute).getBindableJavaType()))
                    {
                        // construct map; recursive
                        // send attribute
                        buildEmbeddedValue(embeddableKeyObj, metaModel, tempBuilder, (SingularAttribute) subAttribute);
                    }
                    else
                    {
                        // append key value
                        appendColumnName(tempBuilder, ((AbstractAttribute) (embeddableKey.getAttribute(embeddableColumn
                                .getName()))).getJPAColumnName());
                        tempBuilder.append(Constants.COLON);
                        appendColumnValue(tempBuilder, embeddableKeyObj, embeddableColumn);
                    }
                    tempBuilder.append(Constants.COMMA);
                }

            }
            // strip last char and append '}'
            tempBuilder.deleteCharAt(tempBuilder.length() - 1);
            tempBuilder.append(Constants.CLOSE_CURLY_BRACKET);
            appendColumnName(embeddedValueBuilder, ((AbstractAttribute) attribute).getJPAColumnName());
            embeddedValueBuilder.append(Constants.COLON);
            embeddedValueBuilder.append(tempBuilder);
        }
        else
        {
            embeddedValueBuilder.deleteCharAt(embeddedValueBuilder.length() - 1);
        }
    }
private void buildEmbeddedValue ( final Object record , MetamodelImpl metaModel , StringBuilder embeddedValueBuilder , SingularAttribute attribute ) { Field field = ( Field ) attribute . getJavaMember ( ) ; EmbeddableType embeddableKey = metaModel . embeddable ( field . getType ( ) ) ; Object embeddableKeyObj = PropertyAccessorHelper . getObject ( record , field ) ; if ( embeddableKeyObj != null ) { StringBuilder tempBuilder = new StringBuilder ( ) ; tempBuilder . append ( Constants . OPEN_CURLY_BRACKET ) ; for ( Field embeddableColumn : field . getType ( ) . getDeclaredFields ( ) ) { if ( ! ReflectUtils . isTransientOrStatic ( embeddableColumn ) ) { Attribute subAttribute = ( SingularAttribute ) embeddableKey . getAttribute ( embeddableColumn . getName ( ) ) ; if ( metaModel . isEmbeddable ( ( ( AbstractAttribute ) subAttribute ) . getBindableJavaType ( ) ) ) { buildEmbeddedValue ( embeddableKeyObj , metaModel , tempBuilder , ( SingularAttribute ) subAttribute ) ; } else { appendColumnName ( tempBuilder , ( ( AbstractAttribute ) ( embeddableKey . getAttribute ( embeddableColumn . getName ( ) ) ) ) . getJPAColumnName ( ) ) ; tempBuilder . append ( Constants . COLON ) ; appendColumnValue ( tempBuilder , embeddableKeyObj , embeddableColumn ) ; } tempBuilder . append ( Constants . COMMA ) ; } } tempBuilder . deleteCharAt ( tempBuilder . length ( ) - 1 ) ; tempBuilder . append ( Constants . CLOSE_CURLY_BRACKET ) ; appendColumnName ( embeddedValueBuilder , ( ( AbstractAttribute ) attribute ) . getJPAColumnName ( ) ) ; embeddedValueBuilder . append ( Constants . COLON ) ; embeddedValueBuilder . append ( tempBuilder ) ; } else { embeddedValueBuilder . deleteCharAt ( embeddedValueBuilder . length ( ) - 1 ) ; } }
Builds the embedded value.

@param record
the record
@param metaModel
the meta model
@param embeddedValueBuilder
the embedded value builder
@param attribute
the attribute