在选择查询中找不到新对象之后的类 [英] Unable to locate class after new object in select query

查看:79
本文介绍了在选择查询中找不到新对象之后的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试此查询时

public interface AppelOffreRespository    extends JpaRepository<AppelOffre, Integer>, QueryDslPredicateExecutor<AppelOffre> {

     @Query("select new AOCalendarModel( ao.xx, ao.yy, ao.zz) from AO ao ...
     Set<AOCalendarModel> findAoForCalForFav(..)

...
}

我收到此错误

org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate class [AOCalendarModel] [select new AOCalendarMode ....

我的模特

public class AOCalendarModel {


    public Integer xx;
    public String yy;
    public Date zz;
    ...
}

推荐答案

我们找到了解决方案我们只添加了AOCalendarModel的完整路径,即formbean.AOCalendarModel

We find the solution We just add the full path of AOCalendarModel which is formbean.AOCalendarModel

 @Query("select new formbean.AOCalendarModel( ao.xx, ao.yy, ao.zz) from AO ao ...
 Set<AOCalendarModel> findAoForCalForFav(..)

这篇关于在选择查询中找不到新对象之后的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆