日期:2014-05-17  浏览次数:20772 次

求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});