private byte[] getBytes(String jpaFieldName, EntityMetadata m, Object value)
    {
        AbstractAttribute idCol = (AbstractAttribute) m.getIdAttribute();
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entity = metaModel.entity(m.getEntityClazz());
        Class fieldClazz = null;
        if (idCol.getName().equals(jpaFieldName))
        {
            Field f = (Field) idCol.getJavaMember();

            if (metaModel.isEmbeddable(idCol.getBindableJavaType()))
            {
                fieldClazz = String.class;
                Map<Attribute, List<Object>> columnValues = new HashMap<Attribute, List<Object>>();
                Field[] fields = m.getIdAttribute().getBindableJavaType().getDeclaredFields();
                EmbeddableType embeddable = metaModel.embeddable(m.getIdAttribute().getBindableJavaType());

                StringBuilder compositeKey = new StringBuilder();
                for (Field field : fields)
                {
                    if (!ReflectUtils.isTransientOrStatic(field))
                    {
                        AbstractAttribute attrib = (AbstractAttribute) embeddable.getAttribute(field.getName());
                        Object obj = PropertyAccessorHelper.getObject(value, field);
                        compositeKey.append(
                                PropertyAccessorHelper.fromSourceToTargetClass(String.class,
                                        attrib.getBindableJavaType(), obj)).append("\001");
                    }
                }
                compositeKey.delete(compositeKey.lastIndexOf("\001"), compositeKey.length());
                value = compositeKey.toString();
            }
            else
            {
                fieldClazz = f.getType();
            }
        }
        else
        {
            StringTokenizer tokenizer = new StringTokenizer(jpaFieldName, ".");
            String embeddedFieldName = null;
            if (tokenizer.countTokens() > 1)
            {
                embeddedFieldName = tokenizer.nextToken();
                String fieldName = tokenizer.nextToken();
                Attribute embeddableAttribute = entity.getAttribute(embeddedFieldName);
                EmbeddableType embeddableType = metaModel.embeddable(embeddableAttribute.getJavaType());
                Attribute embeddedAttribute = embeddableType.getAttribute(fieldName);
                jpaFieldName = ((AbstractAttribute) embeddedAttribute).getJPAColumnName();
                fieldClazz = ((AbstractAttribute) embeddedAttribute).getBindableJavaType();
            }
            else
            {
                String discriminatorColumn = ((AbstractManagedType) entity).getDiscriminatorColumn();

                if (!jpaFieldName.equals(discriminatorColumn))
                {
                    String fieldName = m.getFieldName(jpaFieldName);
                    Attribute col = entity.getAttribute(fieldName);
                    fieldClazz = ((AbstractAttribute) col).getBindableJavaType();
                }
            }
        }

        if (fieldClazz != null)
        {
            return HBaseUtils.getBytes(value, fieldClazz);
        }
        else
        {
            // Treat default as UTF8-Type. { in case of discriminator column}
            return HBaseUtils.getBytes(value, String.class);
        }
    }
private byte [ ] getBytes ( String jpaFieldName , EntityMetadata m , Object value ) { AbstractAttribute idCol = ( AbstractAttribute ) m . getIdAttribute ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; EntityType entity = metaModel . entity ( m . getEntityClazz ( ) ) ; Class fieldClazz = null ; if ( idCol . getName ( ) . equals ( jpaFieldName ) ) { Field f = ( Field ) idCol . getJavaMember ( ) ; if ( metaModel . isEmbeddable ( idCol . getBindableJavaType ( ) ) ) { fieldClazz = String . class ; Map < Attribute , List < Object > > columnValues = new HashMap < Attribute , List < Object > > ( ) ; Field [ ] fields = m . getIdAttribute ( ) . getBindableJavaType ( ) . getDeclaredFields ( ) ; EmbeddableType embeddable = metaModel . embeddable ( m . getIdAttribute ( ) . getBindableJavaType ( ) ) ; StringBuilder compositeKey = new StringBuilder ( ) ; for ( Field field : fields ) { if ( ! ReflectUtils . isTransientOrStatic ( field ) ) { AbstractAttribute attrib = ( AbstractAttribute ) embeddable . getAttribute ( field . getName ( ) ) ; Object obj = PropertyAccessorHelper . getObject ( value , field ) ; compositeKey . append ( PropertyAccessorHelper . fromSourceToTargetClass ( String . class , attrib . getBindableJavaType ( ) , obj ) ) . append ( "\001" ) ; } } compositeKey . delete ( compositeKey . lastIndexOf ( "\001" ) , compositeKey . length ( ) ) ; value = compositeKey . toString ( ) ; } else { fieldClazz = f . getType ( ) ; } } else { StringTokenizer tokenizer = new StringTokenizer ( jpaFieldName , "." ) ; String embeddedFieldName = null ; if ( tokenizer . countTokens ( ) > 1 ) { embeddedFieldName = tokenizer . nextToken ( ) ; String fieldName = tokenizer . nextToken ( ) ; Attribute embeddableAttribute = entity . getAttribute ( embeddedFieldName ) ; EmbeddableType embeddableType = metaModel . embeddable ( embeddableAttribute . getJavaType ( ) ) ; Attribute embeddedAttribute = embeddableType . getAttribute ( fieldName ) ; jpaFieldName = ( ( AbstractAttribute ) embeddedAttribute ) . getJPAColumnName ( ) ; fieldClazz = ( ( AbstractAttribute ) embeddedAttribute ) . getBindableJavaType ( ) ; } else { String discriminatorColumn = ( ( AbstractManagedType ) entity ) . getDiscriminatorColumn ( ) ; if ( ! jpaFieldName . equals ( discriminatorColumn ) ) { String fieldName = m . getFieldName ( jpaFieldName ) ; Attribute col = entity . getAttribute ( fieldName ) ; fieldClazz = ( ( AbstractAttribute ) col ) . getBindableJavaType ( ) ; } } } if ( fieldClazz != null ) { return HBaseUtils . getBytes ( value , fieldClazz ) ; } else { return HBaseUtils . getBytes ( value , String . class ) ; } }
Returns bytes of value object.

@param jpaFieldName
@param m
@param value
@return