當前位置: 首頁>>代碼示例>>Java>>正文


Java Query.getResultList方法代碼示例

本文整理匯總了Java中org.hibernate.Query.getResultList方法的典型用法代碼示例。如果您正苦於以下問題:Java Query.getResultList方法的具體用法?Java Query.getResultList怎麽用?Java Query.getResultList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.Query的用法示例。


在下文中一共展示了Query.getResultList方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPlaceFromType

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromType(String plctype)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> plt=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.pl_type=:plt");
                qry.setParameter("plt", plctype);
                plt=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(plt.isEmpty())
                 {
                     return (null);
                 }
                 else
                 {
                      return (plt);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Fetch.java

示例2: getPlaceFromLocality

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromLocality(String plclocality)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> pllc=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.addr.locality=:plcloc");
                qry.setParameter("plcloc", plclocality);
                pllc=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(pllc.isEmpty())
                 {
                     return (null);
                 }
                 else
                 {
                      return (pllc);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Fetch.java

示例3: getPlaceFromName

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromName(String pname)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> pllc=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.pname=:pnm");
                qry.setParameter("pnm", pname);
                pllc=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(pllc.isEmpty())
                 {
                     return (null);
                 }
                 else
                 {
                      return (pllc);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Fetch.java

示例4: isUserEmailExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserEmailExists(String email)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<String> lst=new ArrayList<String> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.email_id=:eid");
                qry.setParameter("eid", email);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Validate.java

示例5: isUserPhoneExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserPhoneExists(String pno)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<String> lst=new ArrayList<String> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.mob_no=:mobno");
                qry.setParameter("mobno", pno);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Validate.java

示例6: isUserPasswordExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserPasswordExists(String pass)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<String> lst=new ArrayList<String> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.pass=:pss");
                qry.setParameter("pss", pass);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Validate.java

示例7: isPlaceExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isPlaceExists(String desc)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<String> lst=new ArrayList<String> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select pl_id from Places pl where pl.pl_desc=:pldesc");
                qry.setParameter("pldesc", desc);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:44,代碼來源:Validate.java

示例8: isUserExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserExists(String uid, String passw)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<String> lst=new ArrayList<String> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.usr_id=:urid and ud.pass=:passd");
                qry.setParameter("urid", uid);
                qry.setParameter("passd",passw);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                          System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (false);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:EBwn2_ForOpenShift,代碼行數:45,代碼來源:Validate.java

示例9: getPlaceFromType

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromType(String plctype)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> plt=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.pl_type=:plt");
                qry.setParameter("plt", plctype);
                plt=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(plt.isEmpty())
                 {
                      return (null);
                 }
                 else
                 {
                      return (plt);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Fetch.java

示例10: getPlaceFromLocality

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromLocality(String plclocality)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> pllc=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.addr.locality=:plcloc");
                qry.setParameter("plcloc", plclocality);
                pllc=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(pllc.isEmpty())
                 {
                      return (null);
                 }
                 else
                 {
                      return (pllc);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Fetch.java

示例11: getPlaceFromName

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static List<Places> getPlaceFromName(String pname)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Places> pllc=new ArrayList<Places> (); 
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("from Places pl where pl.pname=:pnm");
                qry.setParameter("pnm", pname);
                pllc=(List<Places>)qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                 if(pllc.isEmpty())
                 {
                      return (null);
                 }
                 else
                 {
                      return (pllc);
                 }
            }
            else
            {
                 return (null);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Fetch.java

示例12: isUserEmailExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserEmailExists(String email)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Object> lst=new ArrayList<Object> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.email_id=:eid");
                qry.setParameter("eid", email);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Validate.java

示例13: isUserPhoneExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserPhoneExists(String pno)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Object> lst=new ArrayList<Object> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.mob_no=:mobno");
                qry.setParameter("mobno", pno);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                        return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Validate.java

示例14: isUserPasswordExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isUserPasswordExists(String pass)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Object> lst=new ArrayList<Object> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select usr_id from UserDetails ud where ud.pass=:pss");
                qry.setParameter("pss", pass);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                        return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Validate.java

示例15: isPlaceExists

import org.hibernate.Query; //導入方法依賴的package包/類
synchronized public static boolean isPlaceExists(String desc)
{
         int chk=0;
         sf=Logic.getSf();
         Session s = null;
         List<Object> lst=new ArrayList<Object> ();
         try{
                s=sf.openSession();
                s.beginTransaction();
                Query qry=s.createQuery("select pl_id from Places pl where pl.pl_desc=:pldesc");
                qry.setParameter("pldesc", desc);
                lst=qry.getResultList();
                s.getTransaction().commit();
            }catch (Exception e)
                 {
                         chk=-1;
                         System.out.println("HibernateException Occured!!"+e);
                         e.printStackTrace();
                 }
            finally
                 {
                         if(s!=null)
                         {
                              s.clear();
                              s.close();
                         }
                 }
            if(chk==0)
            {
                  if (lst.isEmpty())
                  {
                        return (false);
                  }
                  else
                  {
                       return (true);
                  }
            }
            else
            {
                 return (true);
            }
}
 
開發者ID:Tejas07PSK,項目名稱:maven_EWorld_OpenShift,代碼行數:44,代碼來源:Validate.java


注:本文中的org.hibernate.Query.getResultList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。