private static void selectWithCoreApi ( CqlSession session ) { // Reading the whole row as a JSON object: Row row = session . execute ( SimpleStatement . newInstance ( "SELECT JSON * FROM examples.querybuilder_json WHERE id = ?" , 1 ) ) . one ( ) ; assert row != null ; System . out . printf ( "Entry #1 as JSON: %s%n" , row . getString ( "[json]" ) ) ; // Extracting a particular column as JSON: row = session . execute ( SimpleStatement . newInstance ( "SELECT id, toJson(specs) AS json_specs FROM examples.querybuilder_json WHERE id = ?" , 2 ) ) . one ( ) ; assert row != null ; System . out . printf ( "Entry #%d's specs as JSON: %s%n" , row . getInt ( "id" ) , row . getString ( "json_specs" ) ) ; }
Demonstrates data retrieval with the core API i . e . providing the full query strings .