NutzCN Logo
问答 nutz dao 批量插入oracle,字段丢值
发布于 2790天前 作者 andyrbm 2279 次浏览 复制 上一个帖子 下一个帖子
标签: dao bug

应用场景是批量插入oracle,数据是用户基本信息。数据全是字符,很简单。
有一个字段A的值为value1,单独插入时,A的值为value1;批量插入时A的值为空字符。
大家知道怎么解决吗?

9 回复

给出可重现该问题的代码

@wendal for(JsonObject jo:list){
Set<Entry<String, JsonElement>> set = jo.entrySet();
for(Entry<String, JsonElement> e:set){
String colName = e.getKey();
String colValue = null;
if(null!=e.getValue()){
colValue=e.getValue().getAsString();
sql.params().set(StringUtils.lowerCase(e.getKey()),e.getValue().getAsString());
}

       }
       try {
         sql.addBatch();
       } catch (Exception e1) {
         logger.error(e1.toString());
       }
    }

    try {
       dao.execute(sql);
    } catch (Exception e) {
       logger.error(e.toString());
    }
		for(JsonObject jo:list){
			Set<Entry<String, JsonElement>> set = jo.entrySet();
			for(Entry<String, JsonElement> e:set){
				String colName = e.getKey();
				String colValue = null;
				if(null!=e.getValue()){
					colValue=e.getValue().getAsString();
					sql.params().set(StringUtils.lowerCase(e.getKey()),e.getValue().getAsString());
				}
				
			}
			try {
				sql.addBatch();
			} catch (Exception e1) {
				logger.error(e1.toString());
			}
		}
		
		try {
			dao.execute(sql);
		} catch (Exception e) {
			logger.error(e.toString());
		}

100%是你的数据本身有问题.

@wendal 把nutz版本从1.a.57 将到1.b.47 问提解决了。

@andyrbm 肯定是其他原因, 不深究一下?

@wendal 你感觉是哪儿问题,我来debug看看。

添加回复
请先登陆
回到顶部