java hibernate 报错 org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class
来源:互联网 发布:肖像漫画软件 编辑:程序博客网 时间:2024/06/05 10:39
用Spring boot 写表连接查询的时候一直报错 Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class [CommonBuyingVO]
commonBuyingVO是我自己写的一个虚类,用来接收两个表的数据,在这个类中也写了全参构造报错的内容为:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class [CommonBuyingVO] [select new CommonBuyingVO(c.comId,c.merchantIds,c.comName,c.comOutMoney,c.comNowMoney,c.comStock,c.com_salesVolume,c.comType,c.comClass,c.comStatus,c.comimgPath,c.comUrl,c.comSort,c.comValidData,c.comAddDate,c.comUpDate,c.comDepict,s.scaBeginDate,s.scaEndDate) from com.example.demo.entity.CommonBuying c ,com.example.demo.entity.ScareBuying s where c.comId=s.proid and c.comType = ?1 and c.comStatus!=?2 and c.merchantIds=?3 ]at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:268) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:76) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:240) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1894) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]... 49 common frames omitted
我的查询语句:
@Query("select new CommonBuyingVO(c.comId,c.merchantIds,c.comName,c.comOutMoney,c.comNowMoney,c.comStock,"+ "c.com_salesVolume,c.comType,c.comClass,c.comStatus,c.comimgPath," + "c.comUrl,c.comSort,c.comValidData,c.comAddDate,c.comUpDate,c.comDepict," + "s.scaBeginDate,s.scaEndDate) from CommonBuying c ,ScareBuying s where c.comId=s.proid and c.comType = ?1 and c.comStatus!=?2 and c.merchantIds=?3 ")List<CommonBuyingVO> getScareBuying(String comType,String comStatus,String merchantIds);解决方法:
@Query("select new com.example.demo.entity.CommonBuyingVO(c.comId,c.merchantIds,c.comName,c.comOutMoney,c.comNowMoney,c.comStock,"+ "c.com_salesVolume,c.comType,c.comClass,c.comStatus,c.comimgPath," + "c.comUrl,c.comSort,c.comValidData,c.comAddDate,c.comUpDate,c.comDepict," + "s.scaBeginDate,s.scaEndDate) from CommonBuying c ,ScareBuying s where c.comId=s.proid and c.comType = ?1 and c.comStatus!=?2 and c.merchantIds=?3 ")List<CommonBuyingVO> getScareBuying(String comType,String comStatus,String merchantIds);在虚类前面指定包的路径,这样写后,就不报错了
阅读全文
0 0
- java hibernate 报错 org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class
- org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class XXX解决
- org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class xxx
- org.hibernate.hql.internal.ast.QuerySyntaxException
- Hibernate查询报错:org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped
- org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped 报错解决
- 使用hibernate的hql语句做查询报错 org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException
- org.hibernate.hql.ast.QuerySyntaxException:
- org.hibernate.hql.internal.ast.QuerySyntaxException: Exam is not mapped
- Window 7下QT5.9.2安装、QTCreator调试器配置
- 分布式架构
- C++反汇编第二讲,不同作用域下的构造和析构的识别
- 最短路径(Floyed算法)
- oracle is not in the sudoers file. This incident will be reported.
- java hibernate 报错 org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class
- Android双击返回退出应用的写法
- Android沉浸式状态栏
- 嵌入式软件可靠性设计
- python3 regex exercise
- 【C++】链接器及undefined reference的秘密
- 集体开发之代码风格一致
- tensorflow入门 Mnist
- 数据库连接池