How to use Hibernate Criteria objects for multiple and/or conditions

后端 未结 2 1102
-上瘾入骨i
-上瘾入骨i 2021-01-31 00:40

I need to create a Hibernate criteria restriction that ors 3 Conditions. The problem is that the last condition is acutally to conditions using the AND operator.

My fir

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-31 01:11

    Criteria criteriaObj = sessionselectreply.createCriteria(TaskReplyVO.class,"taskreply")
                    .createAlias("taskreply.objTaskView", "taskview")
                    .createAlias("objMailTo", "mailto")
                    .add(Restrictions.eq("taskview.longTaskId", taskid))
                    .add(Restrictions.eq("mailto.longuserid", userid));
    

提交回复
热议问题