嗨,我的hql查询是这样的。
@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();\
在上面的查询中,我尝试将showdatetime转换为date,并根据date对总集合求和,但hql不支持转换,我不想使用本机查询。
1条答案
按热度按时间6uxekuva1#
CAST
在hql中受支持,前提是底层数据库支持它。尝试日期的完全限定类名(
java.util.Date
)内部@Query
表情。请参见:
1.hql表达式