List of usage examples for org.hibernate Query setParameterList
Query<R> setParameterList(int position, Object[] values);
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static long getstopscountbytract(String tractId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("STOPS_BY_TRACT_SEL_AGENCIES"); q.setParameter("id", tractId); q.setParameterList("sa", selectedAgencies); //@SuppressWarnings("unchecked") long result = (Long) q.list().get(0); Hutil.getSessionFactory()[sessionindex].close(); return result; }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static long getstopscountbyplace(String placeId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("STOPS_BY_PLACE_SEL_AGENCIES"); q.setParameter("id", placeId); q.setParameterList("sa", selectedAgencies); //@SuppressWarnings("unchecked") long result = (Long) q.list().get(0); Hutil.getSessionFactory()[sessionindex].close(); return result; }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static long getstopscountbyurban(String urbanId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("STOPS_BY_URBAN_SEL_AGENCIES"); q.setParameter("id", urbanId); q.setParameterList("sa", selectedAgencies); //@SuppressWarnings("unchecked") long result = (Long) q.list().get(0); Hutil.getSessionFactory()[sessionindex].close(); return result; }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static long getstopscountbycongdist(String congdistId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("STOPS_BY_CONGDIST_SEL_AGENCIES"); q.setParameter("id", congdistId); q.setParameterList("sa", selectedAgencies); //@SuppressWarnings("unchecked") long result = (Long) q.list().get(0); Hutil.getSessionFactory()[sessionindex].close(); return result; }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static int getroutescountsbyregion(String regionId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("ROUTES_BY_REGION_SEL_AGENCIES"); q.setParameter("id", regionId); q.setParameterList("sa", selectedAgencies); @SuppressWarnings("unchecked") List<GeoStopRouteMap> result = q.list(); Hutil.getSessionFactory()[sessionindex].close(); return result.size(); }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
/** * returns count of routes for a given county *///from ww w . jav a 2s. co m public static int getroutescountsbycounty(String countyId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("ROUTES_BY_COUNTY_SEL_AGENCIES"); q.setParameter("id", countyId); q.setParameterList("sa", selectedAgencies); @SuppressWarnings("unchecked") List<GeoStopRouteMap> result = q.list(); Hutil.getSessionFactory()[sessionindex].close(); return result.size(); }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
/** * returns count of agencies for a given geographic area *//*w ww . j a v a 2 s. com*/ @SuppressWarnings("unchecked") public static int getAgencyCountByArea(String areaId, int type, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q; List<String> results = new ArrayList<String>(); switch (type) { case 0: //counties //System.out.println("The SA size is: "+selectedAgencies.size()); //System.out.println("SA list: "+selectedAgencies.size()); q = session[sessionindex].getNamedQuery("AGENCIES_BY_COUNTY_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); System.out.println("The result size for county " + areaId + " is :" + results.size()); //System.out.println("Query result is: "+results.get(0)); break; case 1: //census tract q = session[sessionindex].getNamedQuery("AGENCIES_BY_TRACT_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); break; case 2: //census place q = session[sessionindex].getNamedQuery("AGENCIES_BY_PLACE_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); break; case 3: //urban area q = session[sessionindex].getNamedQuery("AGENCIES_BY_URBAN_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); break; case 4: //ODOT region q = session[sessionindex].getNamedQuery("AGENCIES_BY_REGION_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); break; case 5: //Congressional District q = session[sessionindex].getNamedQuery("AGENCIES_BY_CONGDIST_SEL_AGENCIES"); q.setParameter("id", areaId); q.setParameterList("sa", selectedAgencies); results = q.list(); break; } Hutil.getSessionFactory()[sessionindex].close(); return results.size(); }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static int getroutescountsbyplace(String placeId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("ROUTES_BY_PLACE_SEL_AGENCIES"); q.setParameter("id", placeId); q.setParameterList("sa", selectedAgencies); @SuppressWarnings("unchecked") List<GeoStopRouteMap> result = q.list(); Hutil.getSessionFactory()[sessionindex].close(); return result.size(); }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static int getroutescountsbytract(String tractId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("ROUTES_BY_TRACT_SEL_AGENCIES"); q.setParameter("id", tractId); q.setParameterList("sa", selectedAgencies); @SuppressWarnings("unchecked") List<GeoStopRouteMap> result = q.list(); Hutil.getSessionFactory()[sessionindex].close(); return result.size(); }
From source file:com.model.database.queries.EventManager.java
License:Open Source License
public static int getroutescountbyurban(String urbanId, List<String> selectedAgencies, int sessionindex) throws FactoryException, TransformException { session[sessionindex].beginTransaction(); Query q = session[sessionindex].getNamedQuery("ROUTES_BY_URBAN_SEL_AGENCIES"); q.setParameter("id", urbanId); q.setParameterList("sa", selectedAgencies); @SuppressWarnings("unchecked") List<GeoStopRouteMap> result = q.list(); Hutil.getSessionFactory()[sessionindex].close(); return result.size(); }