private boolean extractCompositeKey(MetamodelImpl metaModel, EmbeddableType keyObj, StringBuilder builder,
        CQLTranslator translator, List<Object> value, boolean useInClause, Map<Attribute, List<Object>> columnValues,
        Field field) {
        Attribute compositeColumn = keyObj.getAttribute(field.getName());
        String jpaColumnName = ((AbstractAttribute) compositeColumn).getJPAColumnName();

        if (useInClause) {
            for (Object embeddedObject : value) {

                Object valueObject = PropertyAccessorHelper.getObject(embeddedObject, field);
                // Checking for composite partition key.
                if (metaModel.isEmbeddable(((AbstractAttribute) compositeColumn).getBindableJavaType())) {
                    Set<Attribute> attributes = metaModel
                        .embeddable(((AbstractAttribute) compositeColumn).getBindableJavaType()).getAttributes();

                    // Iterating over composite partition key columns.
                    for (Attribute nestedAttribute : attributes) {
                        List<Object> valueList = columnValues.get(compositeColumn);

                        if (valueList == null) {
                            valueList = new ArrayList<Object>();
                        }

                        Object obj =
                            PropertyAccessorHelper.getObject(valueObject, (Field) nestedAttribute.getJavaMember());
                        valueList.add(obj);
                        columnValues.put(nestedAttribute, valueList);
                    }
                } else {
                    List<Object> valueList = columnValues.get(compositeColumn);

                    if (valueList == null) {
                        valueList = new ArrayList<Object>();
                    }
                    valueList.add(valueObject);
                    columnValues.put(compositeColumn, valueList);
                }
            }
        } else {
            Object valueObject = PropertyAccessorHelper.getObject(value.isEmpty() ? null : value.get(0), field);

            // Checking for composite partition key.
            if (metaModel.isEmbeddable(((AbstractAttribute) compositeColumn).getBindableJavaType())) {
                Set<Attribute> attributes =
                    metaModel.embeddable(((AbstractAttribute) compositeColumn).getBindableJavaType()).getAttributes();

                // Iterating over composite partition key columns.
                for (Attribute nestedAttribute : attributes) {
                    String columnName = ((AbstractAttribute) nestedAttribute).getJPAColumnName();
                    Object obj = PropertyAccessorHelper.getObject(valueObject, (Field) nestedAttribute.getJavaMember());
                    translator.buildWhereClause(builder, nestedAttribute.getJavaType(), columnName, obj,
                        CQLTranslator.EQ_CLAUSE, false);
                }
                // returning true because builder has AND clause at end.
                return true;
            } else {
                translator.buildWhereClause(builder, field.getType(), jpaColumnName, valueObject,
                    CQLTranslator.EQ_CLAUSE, false);
                // returning true because builder has AND clause at end.
                return true;
            }
        }
        // returning false because builder does not have AND clause at end.
        return false;
    }
private boolean extractCompositeKey ( MetamodelImpl metaModel , EmbeddableType keyObj , StringBuilder builder , CQLTranslator translator , List < Object > value , boolean useInClause , Map < Attribute , List < Object > > columnValues , Field field ) { Attribute compositeColumn = keyObj . getAttribute ( field . getName ( ) ) ; String jpaColumnName = ( ( AbstractAttribute ) compositeColumn ) . getJPAColumnName ( ) ; if ( useInClause ) { for ( Object embeddedObject : value ) { Object valueObject = PropertyAccessorHelper . getObject ( embeddedObject , field ) ; if ( metaModel . isEmbeddable ( ( ( AbstractAttribute ) compositeColumn ) . getBindableJavaType ( ) ) ) { Set < Attribute > attributes = metaModel . embeddable ( ( ( AbstractAttribute ) compositeColumn ) . getBindableJavaType ( ) ) . getAttributes ( ) ; for ( Attribute nestedAttribute : attributes ) { List < Object > valueList = columnValues . get ( compositeColumn ) ; if ( valueList == null ) { valueList = new ArrayList < Object > ( ) ; } Object obj = PropertyAccessorHelper . getObject ( valueObject , ( Field ) nestedAttribute . getJavaMember ( ) ) ; valueList . add ( obj ) ; columnValues . put ( nestedAttribute , valueList ) ; } } else { List < Object > valueList = columnValues . get ( compositeColumn ) ; if ( valueList == null ) { valueList = new ArrayList < Object > ( ) ; } valueList . add ( valueObject ) ; columnValues . put ( compositeColumn , valueList ) ; } } } else { Object valueObject = PropertyAccessorHelper . getObject ( value . isEmpty ( ) ? null : value . get ( 0 ) , field ) ; if ( metaModel . isEmbeddable ( ( ( AbstractAttribute ) compositeColumn ) . getBindableJavaType ( ) ) ) { Set < Attribute > attributes = metaModel . embeddable ( ( ( AbstractAttribute ) compositeColumn ) . getBindableJavaType ( ) ) . getAttributes ( ) ; for ( Attribute nestedAttribute : attributes ) { String columnName = ( ( AbstractAttribute ) nestedAttribute ) . getJPAColumnName ( ) ; Object obj = PropertyAccessorHelper . getObject ( valueObject , ( Field ) nestedAttribute . getJavaMember ( ) ) ; translator . buildWhereClause ( builder , nestedAttribute . getJavaType ( ) , columnName , obj , CQLTranslator . EQ_CLAUSE , false ) ; } return true ; } else { translator . buildWhereClause ( builder , field . getType ( ) , jpaColumnName , valueObject , CQLTranslator . EQ_CLAUSE , false ) ; return true ; } } return false ; }
Extract composite key.

@param metaModel
the meta model
@param keyObj
the key obj
@param builder
the builder
@param translator
the translator
@param value
the value
@param useInClause
the use in clause
@param columnValues
the column values
@param field
the field
@return true, if successful