org.hibernate.QueryException: Unable to resolve path
来源:互联网 发布:意天物联 知乎 编辑:程序博客网 时间:2024/04/29 12:33
"from po.test where test.name = sdf"
问题之一:
sdf是个字符串值,应该加单引号。不然Hibernate会把它作为类的属性看待,而你的类中是没有sdf这个属性的
问题之二:
from后直接写类名,不必加包名
问题之三:
test是类名,不能直接使用test.name(不能通过类来访问,就好像你不能通过类名去访问实例变量一样),请不要问为什么,记住这是HQL的语法要求就行了。
那怎么办呢?通常会用别名的方式解决,比如
from test as t where t.name = 'sdf'(别名就好像是test类的一个对象,通过对象就可以访问实例变量啦,哈哈)
所以你也可以这样写:
from test as test where test.name = 'sdf'(注意现在test.name中的test是别名了)
当然,仅对一个类进行操作,也可以不借助于别名:
from test where name = 'sdf'
问题之一:
sdf是个字符串值,应该加单引号。不然Hibernate会把它作为类的属性看待,而你的类中是没有sdf这个属性的
问题之二:
from后直接写类名,不必加包名
问题之三:
test是类名,不能直接使用test.name(不能通过类来访问,就好像你不能通过类名去访问实例变量一样),请不要问为什么,记住这是HQL的语法要求就行了。
那怎么办呢?通常会用别名的方式解决,比如
from test as t where t.name = 'sdf'(别名就好像是test类的一个对象,通过对象就可以访问实例变量啦,哈哈)
所以你也可以这样写:
from test as test where test.name = 'sdf'(注意现在test.name中的test是别名了)
当然,仅对一个类进行操作,也可以不借助于别名:
from test where name = 'sdf'
1 0
- org.hibernate.QueryException: Unable to resolve path
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- org.hibernate.QueryException: could not resolve property:
- org.hibernate.QueryException: could not resolve property
- Hibernate HQL之org.hibernate.QueryException:could not resolve
- org.hibernate.QueryException: could not resolve property 错误解析
- Caused by: org.hibernate.QueryException: could not resolve property
- 异常org.hibernate.QueryException: could not resolve property的原因
- 异常org.hibernate.QueryException: could not resolve property相关
- org.hibernate.QueryException: could not resolve property 错误解析
- nested exception is org.hibernate.QueryException:could not resolve property:
- 异常org.hibernate.QueryException: could not resolve property的原因
- 异常**org.hibernate.QueryException: could not resolve property
- org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hib
- org.hibernate.QueryException: could not resolve property:xxxxxid 外键查询 hibernate
- org.hibernate.QueryException: illegal attempt to dereference collection
- 偻乜帐菊既谘魏底裁计湍苍低叵敦
- 手机订餐点菜神器【排队美食】
- 管理教练,在教练和训练使用学习风格
- 替换谷歌自带的安卓开发虚拟机?何不试试下面的虚拟机
- android平台通过socket向C++服务器端发送数据和接收数据的相关问题
- org.hibernate.QueryException: Unable to resolve path
- 管理你的信用分数
- 相机照片找回
- .net之ActiveX开发
- Spring 7大功能模块的作用
- 简历的想法,为什么工作项目符号列表是你的朋友
- android中animator及其监听器在cancel及end时的响应问题
- Java-String 到底是值传递还是引用传递
- 跨域使用字体(火狐浏览器)