码迷,mamicode.com
首页 > 其他好文 > 详细

JPA and ( or )

时间:2019-11-04 13:36:19      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:join   and   jpa   ica   int   cal   gre   get   tween   

Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, Integer.valueOf(reportYear));
Date yearFirst = calendar.getTime();
Calendar calendar0 = Calendar.getInstance();
calendar0.clear();
calendar0.set(Calendar.YEAR, Integer.valueOf(reportYear)+1);
Date yearEnd = calendar0.getTime();

//重点
predicates.add(
        cb.or(
                cb.between(root.get("flowEndTime"),yearFirst,yearEnd),
                cb.greaterThanOrEqualTo(root.join("closeReport", JoinType.LEFT).get("flowEndTime"),yearFirst)
         )
 );
                                 

where project0_.flow_status = ?
and (project0_.flow_end_time between ? and ? or projectclo3_.flow_end_time >= ?)

JPA and ( or )

标签:join   and   jpa   ica   int   cal   gre   get   tween   

原文地址:https://www.cnblogs.com/nm666/p/11791314.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!