请大家帮我看一下在Hibernate下报这个异常该怎么处理?谢谢!
请大家帮我看一下在Hibernate下报这个异常改怎么处理!
我在网上查了一下,说把你的from后面改成是实体类而不是表名,注意大小写。
可是我在代码里改成…… select c from Clazz c there c.name=:name ……运行时还是不行?
Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected token: there near line 1, column 51 [select c from com.xsx.hibernate.bean.Clazz c there c.name=:name]
在问一下,这个查询语句中的“:name”是什么意思?起什么作用?
select c from com.xsx.hibernate.bean.Clazz c there c.name = :name
谢谢了!
hibernate
[解决办法]
Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected token: there near line 1, column 51 [select c from com.xsx.hibernate.bean.Clazz c there c.name=:name]
我看错了 ,还是你写错了 there 还是where?
:name表示name变量值会赋值给c.name
[解决办法]
there 写错了
[解决办法]
楼主主要区分一下hql语句和sql语句的,hql语句这么写:“from 实体类名 where ...” 而sql语句则这么写:“select * from 表名 where ...”
[解决办法]