org.hibernate.propertyaccessexception could not get a field value by reflection getter of
2014-08-21 17:16
399 查看
简言之,
市与省之间存在多对一的联系:
<many-to-one name="province" class="xxx.GeoProvince" not-null="true"></many-to-one>
在查找某一省的所属市的hql中,
错误的写法:
Select pd from Geocity pd where pd.province = '330000';
正确的写法:
Select pd from GeoCity pd where pd.province.adbscd = '330000';
也就是说必须将hql中的province当做一个实体类来处理。
记得我好像以前也碰到过这问题,怎么解决的忘了,今天又遇到了,记一下,也希望对大家有所帮助。
市与省之间存在多对一的联系:
<many-to-one name="province" class="xxx.GeoProvince" not-null="true"></many-to-one>
在查找某一省的所属市的hql中,
错误的写法:
Select pd from Geocity pd where pd.province = '330000';
正确的写法:
Select pd from GeoCity pd where pd.province.adbscd = '330000';
也就是说必须将hql中的province当做一个实体类来处理。
记得我好像以前也碰到过这问题,怎么解决的忘了,今天又遇到了,记一下,也希望对大家有所帮助。
相关文章推荐
- could not get a field value by reflection getter of
- 错误提示:Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for ID
- 解决:ould not find a getter for porDate in class com.bc.bean.PortalSheet Caused by: org.hibernate.PropertyNotFoundException: Could
- Hibernate错误 Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for pnsame i
- org.hibernate.PropertyNotFoundException: Could not find a getter for titlse in class com.po.Intro异常
- nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- " org.hibernate.PropertyNotFoundException:Could not find a getter for ..
- org.hibernate.PropertyNotFoundException: Could not find a getter
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- org.hibernate.PropertyNotFoundException:could not find a getter for name in class ....
- org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- org.hibernate.exception.SQLGrammarException: could not get next sequence value错误原因
- org.hibernate.PropertyNotFoundException Could not find a getter for id in class
- org.hibernate.exception.SQLGrammarException: could not get next sequence value
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette
- org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value
- org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type sette