当前位置: 代码迷 >> Java Web开发 >> 求HQL语句 急
  详细解决方案

求HQL语句 急

热度:4217   发布时间:2013-02-25 21:19:02.0
求HQL语句 急啊 在线等
sql = select * from Data where adddate between "+addDate+" and "+endDate+" and fkpiname = "+name+""
  这句话 怎么写成HQL语句

------解决方案--------------------------------------------------------
return this.getHibernateTemplate().find("select * from Data where adddate between ?and ? and fkpiname = ?",
new Object[] {name,addDate,endDate});

------解决方案--------------------------------------------------------
sql = select * from Data where adddate between "+addDate+" and "+endDate+" and fkpiname = "+name+""
 
换成 sql="from Data where adddate between "+addDate+" and "+endDate+" and fkpiname = "+name+""
 

------解决方案--------------------------------------------------------
hql="from Data where adddate >="+addDate+" and adddate<="+endDate+" and fkpiname = "+name;
------解决方案--------------------------------------------------------
Java code
hql = "from Data where adddate between '"+addDate+"' and '"+endDate+"' and fkpiname = '"+name+"'";
------解决方案--------------------------------------------------------
不需要进行日期转换吗
------解决方案--------------------------------------------------------
hql和sql没有区别呀
sql怎么写,hql就怎么写
------解决方案--------------------------------------------------------
探讨

return this.getHibernateTemplate().find("select * from Data where adddate between ?and ? and fkpiname = ?",
new Object[] {name,addDate,endDate});
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Wed Nov 21 02:16:16 CST 2018
  • 最近登录:Wed Nov 21 02:16:16 CST 2018
  • 最近登录:Wed Nov 21 02:16:16 CST 2018
  • 最近登录:Wed Nov 21 02:16:16 CST 2018
  • 最近登录:Wed Nov 21 02:16:16 CST 2018