我有以下存储库代码:
@Query("SELECT " + FIELDS + " FROM Session ssn WHERE "
+ "(ssn.startDate BETWEEN :startDate AND :endDate ) AND endDate IS
:closed ? NOT : '' NULL ")
List<Session> findByDateAndStatus(@Param("startDate)Date startDate,@Param("endDate")Date endDate,@Param("closed")Boolean closed);
此代码不起作用。我希望此查询根据提供的布尔参数获取关闭的会话或打开的会话。
"AND endDate IS :closed ? NOT : '' NULL "
我想根据我的自定义布尔参数编写 HQL 字符串。怎么做?