用于Hashmap的hibernate映射配置xml文件

时间:2017-10-18 12:40:37

标签: java xml hibernate

我正在尝试使用hibernate将CSV数据推送到数据库中。 CSV文件可以包含任何编号。列,所以pojo类需要是动态的,因为它不能有getter和setter,因为我不知道有多少列。所以,我使用带有键的hashmap作为列名和对应的值在一个特定的CSV行中。当我遍历行时​​,将替换先前的值并添加新值。

我的POJO课程:

 public class mapojo {
 static HashMap<String,String> record=new HashMap<String, String>();
    mapojo(String[] keycolumns) {
    for(int i=0;i<keycolumns.length;i++) {
        record.put(keycolumns[i],"");
    }
    }
    public static void addvalue(String[] recordvalue) {
    int i=0;
    for(Entry<String, String> entry : record.entrySet()) {
        record.replace(entry.getKey(), entry.getValue(),recordvalue[i]);
        i++;
    }
    }

现在我不知道如何为Map创建一个映射配置文件。如果有人能指出我正确的方向,那将会非常有用。

感谢。

0 个答案:

没有答案
相关问题