Hi,my HQL query is like this.
@Query("select A.TheaterName as theater,A.MovieName as movie,CAST(A.ShowDateTime as showDate)" +
"(select sum(TicketPrice) from ccmsfdb2.HallApi.TicketTransaction where \n" +
"CAST(ShowDateTime as date)=CAST(A.ShowDateTime as Date) AND\n" +
" MovieName=A.MovieName and TheaterName=A.TheaterName and TicketStatusValue=1) as collection\n" +
"from CCMSFDB2.HallApi.TicketTransaction A where A.MovieName='Sanju' \n" +
"and A.TheaterName='QFX Jai Nepal' \n" +
"group by CAST(A.ShowDateTime as date),A.TheaterName,A.MovieName,CAST(A.ShowDateTime as Date) order by showDate DESC")
List<MovieCollectionAccordingToTheaaterDto> getMovieCollectionAccordingToTheater();\
In the above query,I have tried to cast showdatetime as date and sum the gross collection according to date but cast is not supported in hql and i don't want to use native query.
CAST
is supported in HQL, given that the underlying DB supports it.
Try full-qualified class name for Date( java.util.Date
) inside the @Query
expression.
See:
1. HQL Expressions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.