首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

ssh 查询语句 hql 错误

2012-02-04 
ssh 查询语句 hql 异常Struts has detected an unhandled exception:Messages: unexpected token: * near

ssh 查询语句 hql 异常
Struts has detected an unhandled exception: 

Messages: unexpected token: * near line 1, column 8 [select * from trade as t where t.id=123 and t.efficient=false] 
 
File: org/hibernate/hql/ast/QuerySyntaxException.java 

是查询语句错了吗?

源代码:
public String query()
{
Session s = HibernateUtil.getSession();
Transaction t=s.beginTransaction();

String uid=application.get("r1").toString();
int a=Integer.parseInt(uid);

Query q=s.createQuery("select * from trade as t where t.id=" + a + " and t.efficient=false");
List<Trade> trades=(List<Trade>)q.list();
application.put("result", trades);

return SUCCESS;
}
我想把查询结果存放在application中 然后在jsp页面中显示出查询结果

[解决办法]
hql里没有*一说
[解决办法]
false 要加单引号么?
[解决办法]
from trade as t where t.id=" + a + " and t.efficient=false

热点排行