hibernate里想把 一个字段里所有的 null  转成  “”  空字符串
语句怎么写

解决方案 »

  1.   

    再详细描述一下
    名字   年龄
    张三    null
    李四    null
    王五    null
    小敏    null
    如何改成
    名字   年龄
    张三     "" 
    李四     ""
    王五     ""
    小敏     ""
    求这样的一句hql
      

  2.   

    String hql = "from table as T where T.coloumn is null";
    List list = this.getHibernateTemplate().find(hql);
    for(iterator it = list.iterator;it.hashnext();){
      Table table = (Table)it.next();//table作为修改表字段的映射类
      this.getHibernateTemplate().saveOrUpdate(Table);
    }
      

  3.   

    哦,忘记了,在saveOrUpdate前加上table.setColumn("");