public String prepSetStatus3(char status, String url) { Map<String, Object> params = new HashMap<String, Object>(); params.put("url", url); String hql = "from Workload o where o.url= :url"; Query query = workloaddao.createQuery(hql, params); List<Workload> workloadlist = (ArrayList<Workload>) query.list(); for (Workload workload : workloadlist) { workload.setStatus((new Character(status)).toString()); workloaddao.save(workload); } return "1"; }
public char prepGetStatus(String url) { Map<String, Object> params = new HashMap<String, Object>(); params.put("url", url); String hql = "from Workload o where o.url= :url"; Query query = workloaddao.createQuery(hql, params); List<Workload> workloadlist = (ArrayList<Workload>) query.list(); if (workloadlist.size() == 0) return 'U'; else { Workload wl = workloadlist.get(0); return wl.getStatus().charAt(0); } }