6

When I try this query

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;
    ...
}
Hayi
  • 6,972
  • 26
  • 80
  • 139

2 Answers2

12

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(..)
Hayi
  • 6,972
  • 26
  • 80
  • 139
0

Normally you setup Repository Scanning and annotate your entities with @Entity

Maybe check how you registered the AOCalendarModel in your Spring Container.

d0x
  • 11,040
  • 17
  • 69
  • 104