private static String getValueForId ( int id , String fieldName , String namespace , Table table , Connection connection ) throws SQLException { String tableName = String . join ( "." , namespace , table . name ) ; String selectIdSql = String . format ( "select %s from %s where id = %d" , fieldName , tableName , id ) ; LOG . info ( selectIdSql ) ; Statement selectIdStatement = connection . createStatement ( ) ; ResultSet selectResults = selectIdStatement . executeQuery ( selectIdSql ) ; String value = null ; while ( selectResults . next ( ) ) { value = selectResults . getString ( 1 ) ; } return value ; }
For a given integer ID return the value for the specified field name for that entity .