Java 获取要放入hashmap的tableName值

Java 获取要放入hashmap的tableName值,java,Java,我需要把价值观。。进入地图。。 我的代码如下: public HashMap getValuesFromDeleteActionString表名,Object[]filterColumn,Object[]filterValue{ Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; HashMap map = new Has

我需要把价值观。。进入地图。。 我的代码如下:

public HashMap getValuesFromDeleteActionString表名,Object[]filterColumn,Object[]filterValue{

    Connection conn = null;
            ResultSet rs = null;
            PreparedStatement ps = null;
            HashMap map = new HashMap();

            try{
                System.out.println("====DELETE_ACTION===");
                conn=this.getConnection();
                if(conn!=null && !conn.isClosed()){
                        if(filterColumn!=null && filterValue!=null && !tableName.trim().isEmpty()
                                &&filterColumn.length==filterValue.length){
                         String sql = "SELECT * FROM "+tableName+"";    
                         String filterSql = " WHERE " ;
                            for(int i=0;i<filterColumn.length;i++){
                                if(i==0){
                                 filterSql = filterColumn[i]+"="+"'"+filterValue[i]+"'";
                                }else{
                                    filterSql= filterSql+" AND "+filterColumn[i]+"="+"'"+filterValue[i]+"'";                                    }
                                 }
                        String sSql=sql+filterSql;
                        ps = conn.prepareStatement(sSql);
                        rs=ps.executeQuery();
                        while(rs.next())
                        {
                            map.put(tableName +"LAST_UPDATE_DATE", rs.getString("LAST_UPDATE_DATE"));
                            map.put(tableName +"LAST_UPDATE_BY" , rs.getString("LAST_UPDATE_BY"));
                        }
                        }else{
                        //do nothing
                     }
                    System.out.println("MapValues==2323===>"+map);

               }
            }catch(Exception e){

        }
        return map;
}

首先,通过以下方法定义地图:

 Map<String,String> map = new HashMap<String, String>();

这里你真的不需要其他东西。超级大黄蜂..我找到了解决方案..因为我在定义过滤列和过滤值时犯了错误..这就是为什么..非常感谢
while(rs.next()) {
 map.put("LAST_UPDATE_DATE", rs.getString("LAST_UPDATE_DATE"));
 map.put("LAST_UPDATE_BY", rs.getString("LAST_UPDATE_BY"));
}