最近用maven+SSH做项目练手,测试时用hql语句查表时报错,使用的注解配置类属性的关联关系,因为对hibernate注解不太熟练,其余的使用hibernate反向生成的配置文件。
单元测试报错如下:
org.hibernate.QueryException: could not resolve property: account of: beanFactory.Category [from beanFactory.Category c left join fetch c.account where c.type like :type]
Category 类中有个类属性 Account 对应 数据库中category表account_id字段,也是外键,绑定account表中的id
在完全用配置文件的情况下可以执行,总觉得是注解的问题导致查询时找不到account字段,请大侠帮忙分析下是哪里出了问题?