protected < E > List < E > getColumnsByIdUsingCql ( String schemaName , String tableName , String pKeyColumnName , String columnName , Object pKeyColumnValue , Class columnJavaType ) { // select columnName from tableName where pKeyColumnName = // pKeyColumnValue List results = new ArrayList ( ) ; CQLTranslator translator = new CQLTranslator ( ) ; String selectQuery = translator . SELECT_QUERY ; selectQuery = StringUtils . replace ( selectQuery , CQLTranslator . COLUMN_FAMILY , translator . ensureCase ( new StringBuilder ( ) , tableName , false ) . toString ( ) ) ; selectQuery = StringUtils . replace ( selectQuery , CQLTranslator . COLUMNS , translator . ensureCase ( new StringBuilder ( ) , columnName , false ) . toString ( ) ) ; StringBuilder selectQueryBuilder = new StringBuilder ( selectQuery ) ; selectQueryBuilder . append ( CQLTranslator . ADD_WHERE_CLAUSE ) ; translator . buildWhereClause ( selectQueryBuilder , columnJavaType , pKeyColumnName , pKeyColumnValue , CQLTranslator . EQ_CLAUSE , false ) ; selectQueryBuilder . delete ( selectQueryBuilder . lastIndexOf ( CQLTranslator . AND_CLAUSE ) , selectQueryBuilder . length ( ) ) ; CqlResult cqlResult = execute ( selectQueryBuilder . toString ( ) , getRawClient ( schemaName ) ) ; Iterator < CqlRow > rowIter = cqlResult . getRows ( ) . iterator ( ) ; while ( rowIter . hasNext ( ) ) { CqlRow row = rowIter . next ( ) ; if ( ! row . getColumns ( ) . isEmpty ( ) ) { Column column = row . getColumns ( ) . get ( 0 ) ; Object columnValue = CassandraDataTranslator . decompose ( columnJavaType , column . getValue ( ) , true ) ; results . add ( columnValue ) ; } } return results ; }
Find inverse join column values for join column .