question: protected void fillTable ( JComboBox cb ) { ValueNamePair select = null ; String sql = "SELECT AD_Table_ID, TableName FROM AD_Table t " + "WHERE EXISTS (SELECT * FROM AD_Column c" + " WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted')" + " AND IsView='N'" ; try { PreparedStatement pstmt = DB . prepareStatement ( sql , null ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { int id = rs . getInt ( 1 ) ; String tableName = rs . getString ( 2 ) ; String name = Msg . translate ( Env . getCtx ( ) , tableName + "_ID" ) ; ValueNamePair pp = new ValueNamePair ( tableName , name ) ; cb . addItem ( pp ) ; tableInfo . put ( tableName , new Integer ( id ) ) ; if ( id == AD_Table_ID ) select = pp ; } rs . close ( ) ; pstmt . close ( ) ; } catch ( SQLException e ) { log . log ( Level . SEVERE , sql , e ) ; } if ( select != null ) cb . setSelectedItem ( select ) ; }
target:  Fill Table with ValueNamePair (TableName, translatedKeyColumnName) and tableInfo with (TableName, AD_Table_ID) and select the entry for AD_Table_ID