日期:2014-05-16  浏览次数:20634 次

取数据?级联
Java code
    public List<City> findAllCity(Integer pid){
        
        List<City> list=null;
        try {
            String hql="from city where pid="+pid;
            list=getSession().createCriteria(hql).list();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }



province 表 里面有city id 

查询

list 怎么是空的

------解决方案--------------------
String hql="from city where pid="+pid;
这里是不是少了些内容,换成“String hql="select * from city where pid="+pid;
”试一下
------解决方案--------------------
String hql="from city where pid="+pid;
这句打印出来看看。是什么