问题描述
- hql语句只能查询出数据库里面的第一条数据
- dao层
//查询所有的信息 public List<Stock> getAll() { String hql = ""FROM Stock s LEFT OUTER JOIN FETCH s.people""; return getSession().createQuery(hql).list(); }
service层
public List<Stock> getAll() { return stockDao.getAll(); }
action
@SuppressWarnings(""serial"") @Controller public class StockAction extends ActionSupport implements RequestAwareModelDriven<Stock>Preparable{ @Resource public IStockService stockService; private Stock model;//声明一个stock public Stock getModel(){ return model; } //得到一个请求域 Map<String Object> request; public void setRequest(Map<String Object> arg0) { this.request = arg0; } //查询 public String find(){ request.put(""stock"" stockService.getAll()); return ""findAll""; }
解决方案
问题已解决。。jsp页面少东西了~~~~(>_<)~~~~
时间: 2024-10-03 12:20:47