当我尝试此查询时
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;
...
}
答案 0 :(得分:9)
我们找到解决方案我们只添加AOCalendarModel
的完整路径formbean.AOCalendarModel
@Query("select new formbean.AOCalendarModel( ao.xx, ao.yy, ao.zz) from AO ao ...
Set<AOCalendarModel> findAoForCalForFav(..)
答案 1 :(得分:0)
通常,您设置存储库扫描并使用@Entity
也许检查一下如何在Spring容器中注册AOCalendarModel
。