Could not find class after new object in selected query

When will I try this request

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(..) ... } 

I got this error

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

My model

 public class AOCalendarModel { public Integer xx; public String yy; public Date zz; ... } 
+5
source share
2 answers

We find a solution. We just add the full path AOCalendarModel , which is equal to formbean.AOCalendarModel

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

Usually you set up repository scanning and annotate your objects with @Entity

Perhaps check how you registered AOCalendarModel in the Spring container.

0
source

Source: https://habr.com/ru/post/1209605/


All Articles