有一个数据库字段是这样的属性,ch,en,fr,ge 要求外面传进一个变量在这个变量的里面的一个,就是用“,”分割开的一个,例如ch

解决方案 »

  1.   

    没有明白你说的意思
    但是如果你要拆分字符串的话 就要String.split(",");
      

  2.   

    我的意思是数据库有个字段的VALUE是"ch,en,fr,ge," 我传进一个参数可能是ch,可能是en,还可能是fr或者ge,请问如何查询包含有ch的这条数据
      

  3.   

    from A a where a.ch in ('ch', 'en', 'fr', 'ge') 
      

  4.   

    = ’ch',
    或,like ‘ch‘
    试试
      

  5.   

    贴个很久很久以前写的方法
    public Employee getLastEmployee(String match) throws SystemException {
    try{
    List list=null;
            Employee employee=null;
            String hql="from Employee where employeecode like '"+match+"%' order by employeecode desc";
            list=dao.findByHqlBound(hql);
            if(list!=null && list.size()!=0){
             employee=(Employee)list.get(0);
            }
    return employee;
    }catch(DataAccessException ex){
    /**
     * 向上层抛出系统异常,所有系统异常均以 9XXXX 格式 
     * 90001: 系统出错,请重新登陆或联系系统管理员!
     */
    throw new SystemException("90001",ex);
    }
    }