private static void selectJsonColumn ( CqlSession session ) { Statement stmt = selectFrom ( "examples" , "json_jackson_column" ) . all ( ) . whereColumn ( "id" ) . in ( literal ( 1 ) , literal ( 2 ) ) . build ( ) ; ResultSet rows = session . execute ( stmt ) ; for ( Row row : rows ) { int id = row . getInt ( "id" ) ; // retrieve the JSON payload and convert it to a User instance User user = row . get ( "json" , User . class ) ; // it is also possible to retrieve the raw JSON payload String json = row . getString ( "json" ) ; System . out . printf ( "Retrieved row:%n id %d%n user %s%n user (raw) %s%n%n" , id , user , json ) ; } }
Retrieving User instances from a table column