List of usage examples for org.hibernate Query iterate
Iterator<R> iterate();
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getTitleType(String titleTypeKey) throws ServiceLocatorException { List titleTypeList = new ArrayList();//Description if (CacheManager.getCache().containsKey(titleTypeKey)) { titleTypeList = (List) CacheManager.getCache().get(titleTypeKey); } else {//from w ww. j a v a2s .co m //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from titleTypeData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. titleTypeList.add(desc); } // closing for loop. CacheManager.getCache().put(titleTypeKey, titleTypeList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return titleTypeList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getPoLineCategory(String poLineCategoryKey) throws ServiceLocatorException { List poLineCategoryTypesList = new ArrayList();//Description if (CacheManager.getCache().containsKey(poLineCategoryKey)) { poLineCategoryTypesList = (List) CacheManager.getCache().get(poLineCategoryKey); } else {/*from w w w . j a v a 2 s . c o m*/ //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from PoLineCategoryData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. poLineCategoryTypesList.add(desc); } // closing for loop. CacheManager.getCache().put(poLineCategoryKey, poLineCategoryTypesList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return poLineCategoryTypesList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getPoLine(String poLineKey) throws ServiceLocatorException { List poLineTypesList = new ArrayList();//Description if (CacheManager.getCache().containsKey(poLineKey)) { poLineTypesList = (List) CacheManager.getCache().get(poLineKey); } else {/*from ww w . jav a2s . c om*/ //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from PoLineData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. poLineTypesList.add(desc); } // closing for loop. CacheManager.getCache().put(poLineKey, poLineTypesList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return poLineTypesList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getPoStatus(String poStatusKey) throws ServiceLocatorException { List poStatusList = new ArrayList();//Description if (CacheManager.getCache().containsKey(poStatusKey)) { poStatusList = (List) CacheManager.getCache().get(poStatusKey); } else {/*from w w w .jav a 2s . c om*/ //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from PoStatusData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. poStatusList.add(desc); } // closing for loop. CacheManager.getCache().put(poStatusKey, poStatusList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return poStatusList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getInvoiceStatus(String invoiceStatusKey) throws ServiceLocatorException { List invoiceStatusTypesList = new ArrayList();//Description if (CacheManager.getCache().containsKey(invoiceStatusKey)) { invoiceStatusTypesList = (List) CacheManager.getCache().get(invoiceStatusKey); } else {//from w w w. j a v a2 s . c o m //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from InvoiceStatusData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. invoiceStatusTypesList.add(desc); } // closing for loop. CacheManager.getCache().put(invoiceStatusKey, invoiceStatusTypesList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return invoiceStatusTypesList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getCrmNote(String crmNoteKey) throws ServiceLocatorException { List crmNoteTypesList = new ArrayList();//Description if (CacheManager.getCache().containsKey(crmNoteKey)) { crmNoteTypesList = (List) CacheManager.getCache().get(crmNoteKey); } else {/* w w w .j a v a 2s.c o m*/ //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from CrmNoteData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. crmNoteTypesList.add(desc); } // closing for loop. CacheManager.getCache().put(crmNoteKey, crmNoteTypesList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return crmNoteTypesList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getEmpCurrentState(String empCurrentStateKey) throws ServiceLocatorException { List empCurrentSateList = new ArrayList();//Description if (CacheManager.getCache().containsKey(empCurrentStateKey)) { empCurrentSateList = (List) CacheManager.getCache().get(empCurrentStateKey); } else {//from w ww . j av a 2 s .c om //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from EmpCurrentState as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. empCurrentSateList.add(desc); } // closing for loop. CacheManager.getCache().put(empCurrentStateKey, empCurrentSateList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. // System.out.println("empCurrentSateList"+empCurrentSateList); return empCurrentSateList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getCrmCampaignContacts(String crmCampaignContactsKey) throws ServiceLocatorException { List crmCampaignContactsList = new ArrayList();//Description if (CacheManager.getCache().containsKey(crmCampaignContactsKey)) { crmCampaignContactsList = (List) CacheManager.getCache().get(crmCampaignContactsKey); } else {//www. ja va 2 s. c om //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from CrmCampaignContactsData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. crmCampaignContactsList.add(desc); } // closing for loop. CacheManager.getCache().put(crmCampaignContactsKey, crmCampaignContactsList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return crmCampaignContactsList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getCrmCampaignStatus(String crmCampaignStatusKey) throws ServiceLocatorException { List crmCampaignStatusList = new ArrayList();//Description if (CacheManager.getCache().containsKey(crmCampaignStatusKey)) { crmCampaignStatusList = (List) CacheManager.getCache().get(crmCampaignStatusKey); } else {//ww w .j a v a 2s . c o m //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from CrmCampaignStatusData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. crmCampaignStatusList.add(desc); } // closing for loop. CacheManager.getCache().put(crmCampaignStatusKey, crmCampaignStatusList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return crmCampaignStatusList;// returning the object. }
From source file:com.mss.mirage.util.HibernateDataProvider.java
License:Open Source License
public List getCrmCampaignType(String crmCampaignTypeKey) throws ServiceLocatorException { List crmCampaignTypeList = new ArrayList();//Description if (CacheManager.getCache().containsKey(crmCampaignTypeKey)) { crmCampaignTypeList = (List) CacheManager.getCache().get(crmCampaignTypeKey); } else {//w w w . j a v a 2s. co m //getting sessionFactory for the HibernateUtil class. Session session = HibernateServiceLocator.getInstance().getSession(); //Creating a transaction for the session object. Transaction tran = session.beginTransaction(); //Genarating a quary for retrieving the data from the database. String SQL_STG = "select tp.description from CrmCampaignTypeData as tp"; Query query = session.createQuery(SQL_STG); for (Iterator it = query.iterate(); it.hasNext();) { String desc = (String) it.next(); //Storing values into the TreeList. crmCampaignTypeList.add(desc); } // closing for loop. CacheManager.getCache().put(crmCampaignTypeKey, crmCampaignTypeList); try { // Closing hibernate session session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } finally { if (session != null) { try { session.close(); session = null; } catch (HibernateException he) { throw new ServiceLocatorException(he); } } } } // closing if condition. return crmCampaignTypeList;// returning the object. }