[b]Hibernate version:3.1[/b] Hi to all, I have a mysql view, that make a join bewteen 2 tables (mysql). When I launch a query by java-hibernate on this view, the code generated is correct (read with debug in the java console) and returns a correct arraylist of objects. But the criteria list (crit.list()) return a wrong arraylist of objects, where the last object is incorrect (it repeats the previus object in the list) the code in java is:
public List<TheObjectViewObj> searchObjectsByPeriod(MyObjectObj myObject, Date startDate, Date endDate) { Session s = HibernateUtil.currentSession(); s.clear(); ArrayList<TheObjectViewObj> result = new ArrayList<TheObjectViewObj>(); Criteria crit = s.createCriteria(TheObjectViewObj.class); if((myObject.getCodice()!=null)&&(!myObject.getCodice().toString().trim().equals(""))){ crit.add(Restrictions.eq("codObject", myObject.getCode())); } crit.add(Restrictions.ne("status", IConstants.STATUS_01)); //crit.add(Restrictions.or(Restrictions.between("date",startDate,endDate ),Restrictions.isNull("date"))); crit.add(Restrictions.between("date",startDate,endDate )); crit.addOrder(Order.asc("date")); result.addAll(crit.list()); return result; }
How is it possible? This is the only query I have with this problem. Thanks in advance
|