当我尝试这个查询

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

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

09-19 00:55