List of usage examples for org.hibernate Query setParameterList
Query<R> setParameterList(int position, Object[] values);
From source file:DAOS.MonthlyHistoryReportImp.java
public ArrayList<DailyHistory> getMonthlyHistory(int garageId) { ArrayList<DailyHistory> result = null; try {// w w w. j av a2 s .c o m monthlyHistoryReportSession.beginTransaction(); Query q = monthlyHistoryReportSession.createQuery("from MonthlyHistory where slotId in :slotid"); q.setParameterList("slotid", getGarageSlots(garageId)); result = (ArrayList<DailyHistory>) q.list(); } catch (Exception ex) { ex.printStackTrace(); } finally { monthlyHistoryReportSession.getTransaction().commit(); } return result; }
From source file:DAOS.MonthlyHistoryReportImp.java
public ArrayList<ReportsInterface> getConsiceMonthlyHistory(int garageId) { Garage garage = GarageImp.getInstance().getGarage(garageId); ArrayList<ReportsInterface> result = new ArrayList<>(); ;/* w w w .jav a 2s. c om*/ try { Query q = monthlyHistoryReportSession.createQuery( " select recordDate , sum(hours) , sum(income) from MonthlyHistory where slotId in :slotid group by recordDate order by recordDate "); q.setParameterList("slotid", garage.getGarageStatus()); ArrayList<Object[]> res = (ArrayList<Object[]>) q.list(); for (Object[] obj : res) { result.add(new DailyHistory((Date) obj[0], Double.valueOf(obj[1].toString()), Double.valueOf(obj[2].toString()))); } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public List<DailyHistory> getDailyHistory(int garageId) { List result = new ArrayList<DailyHistory>(); try {// w ww . j a v a2s . c o m Garage garage = (Garage) garageSession.get(Garage.class, garageId); if (garage != null) { if (garage.getGarageStatus().size() > 0) { Query q = garageSession.createQuery("from DailyHistory where slotId in :slotid"); q.setParameterList("slotid", garage.getGarageStatus()); result = (ArrayList<DailyHistory>) q.list(); } } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public ArrayList<ReportsInterface> getConsiceDailyHistory(int garageId) { Garage garage = GarageImp.getInstance().getGarage(garageId); ArrayList<ReportsInterface> result = new ArrayList<>(); ;/* www .j ava2 s .c om*/ try { Query q = garageSession.createQuery( "select recordDate , sum(hours) ,sum( income) from DailyHistory where slotId in :slotid group by recordDate order by recordDate "); q.setParameterList("slotid", garage.getGarageStatus()); ArrayList<Object[]> res = (ArrayList<Object[]>) q.list(); for (Object[] obj : res) { result.add(new DailyHistory((Date) obj[0], Double.valueOf(obj[1].toString()), Double.valueOf(obj[2].toString()))); } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public List<DailyHistory> getMonthlyHistory(int garageId) { List result = new ArrayList<DailyHistory>(); try {/*from w w w. j a va2 s .c om*/ Garage garage = (Garage) garageSession.get(Garage.class, garageId); if (garage != null) { if (garage.getGarageStatus().size() > 0) { Query q = garageSession.createQuery("from MonthlyHistory where slotId in :slotid"); q.setParameterList("slotid", garage.getGarageStatus()); result = (ArrayList<DailyHistory>) q.list(); } } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public ArrayList<ReportsInterface> getConsiceMonthlyHistory(int garageId) { Garage garage = GarageImp.getInstance().getGarage(garageId); ArrayList<ReportsInterface> result = new ArrayList<>(); ;//www .ja v a2 s . co m try { Query q = garageSession.createQuery( " select recordDate , sum(hours) , sum(income) from MonthlyHistory where slotId in :slotid group by recordDate order by recordDate "); q.setParameterList("slotid", garage.getGarageStatus()); ArrayList<Object[]> res = (ArrayList<Object[]>) q.list(); for (Object[] obj : res) { result.add(new DailyHistory((Date) obj[0], Double.valueOf(obj[1].toString()), Double.valueOf(obj[2].toString()))); } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public ArrayList<ReportsInterface> getConsiceYearlyHistory(int garageId) { Garage garage = GarageImp.getInstance().getGarage(garageId); ArrayList<ReportsInterface> result = new ArrayList<>(); ;/*from w w w . j a va2s. co m*/ try { Query q = garageSession.createQuery( " select recordDate , sum(hours) , sum(income) from YearlyHistory where slotId in :slotid group by recordDate order by recordDate "); q.setParameterList("slotid", garage.getGarageStatus()); ArrayList<Object[]> res = (ArrayList<Object[]>) q.list(); for (Object[] obj : res) { result.add(new DailyHistory((Date) obj[0], Double.valueOf(obj[1].toString()), Double.valueOf(obj[2].toString()))); } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.ReportsImp.java
public List<DailyHistory> getYearlyHistory(int garageId) { List result = new ArrayList<DailyHistory>(); try {//from ww w .j a v a 2 s . c o m Garage garage = (Garage) garageSession.get(Garage.class, garageId); if (garage != null) { if (garage.getGarageStatus().size() > 0) { Query q = garageSession.createQuery("from YearlyHistory where slotId in :slotid"); q.setParameterList("slotid", garage.getGarageStatus()); result = (ArrayList<DailyHistory>) q.list(); } } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.YearlyHistoryReportImp.java
public ArrayList<ReportsInterface> getConsiceYearlyHistory(int garageId) { Garage garage = GarageImp.getInstance().getGarage(garageId); ArrayList<ReportsInterface> result = new ArrayList<>(); ;//from w ww . j a v a2 s .c o m try { Query q = yearlyHistoryReportSession.createQuery( " select recordDate , sum(hours) , sum(income) from YearlyHistory where slotId in :slotid group by recordDate order by recordDate "); q.setParameterList("slotid", garage.getGarageStatus()); ArrayList<Object[]> res = (ArrayList<Object[]>) q.list(); for (Object[] obj : res) { result.add(new DailyHistory((Date) obj[0], Double.valueOf(obj[1].toString()), Double.valueOf(obj[2].toString()))); } } catch (Exception ex) { ex.printStackTrace(); } return result; }
From source file:DAOS.YearlyHistoryReportImp.java
public ArrayList<DailyHistory> getYearlyHistory(int garageId) { ArrayList<DailyHistory> result = null; try {/*from www . ja va 2 s . c o m*/ yearlyHistoryReportSession.beginTransaction(); Query q = yearlyHistoryReportSession.createQuery("from YearlyHistory where slotId in :slotid"); q.setParameterList("slotid", getGarageSlots(garageId)); result = (ArrayList<DailyHistory>) q.list(); } catch (Exception ex) { ex.printStackTrace(); } finally { yearlyHistoryReportSession.getTransaction().commit(); } return result; }