添加注解的类Category映射表category,类中有个类属性account 映射表中的accound_id字段,与表Account 中的id字段关联。
现在hql查询报错
之前用hibernate反向生成的配置文件运行查询结果正常,后来将配置文件中的many to one和set用注释代替后查询报错。
之前配置文件中的配置:
后将配置文件many to one 和set 改用注释:
hql语句:
错误提示:
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]
推测可能是注解哪里出问题了,没有关联到account_id 导致查询时找不到account属性,大侠看下问题在哪?