本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}