JPQL and CriteriaBuilder combination query issue "Or operator"

Description

when i used complex query conditions in JPQL,such as:
---------------------------------------------------------------------------------
select entity from WorkflowInstanceStepEntity entity where
(entity.workflowInstance.isend = 0 and entity.workflowInstance.state = 0)
and(
(entity.stepOperatorRange = 11 and entity.operatorId = ?)
or (entity.stepOperatorRange = 12 and (entity.operatorId = ? or entity.operatorId = ? ))
or (entity.stepOperatorRange = 13 and (entity.operatorId = ? or entity.operatorId = ? ))
)
----------------------------------------------------------------------------------
when the JPQL run in tomcat,the system output SQL like is:
------------------------------------------------------------------------------------
select
workflowin0_.id as id1_75_,
workflowin0_.createDate as createDa2_75_,
workflowin0_.modifyDate as modifyDa3_75_,
workflowin0_.nodeStatus as nodeStat4_75_,
workflowin0_.operatorId as operator5_75_,
workflowin0_.state as state6_75_,
workflowin0_.stepName as stepName7_75_,
workflowin0_.stepOperatorRange as stepOper8_75_,
workflowin0_.stepOrders as stepOrde9_75_,
workflowin0_.workflowInstance_id as workflo10_75_
from
ex_workflow_instance_step workflowin0_ cross
join
ex_workflow_instance workflowin1_
where
workflowin0_.workflowInstance_id=workflowin1_.id
and workflowin1_.isend=0
and workflowin1_.state=0
and (
workflowin0_.stepOperatorRange=11
and workflowin0_.operatorId=?
or workflowin0_.stepOperatorRange=12
and (
workflowin0_.operatorId=?
or workflowin0_.operatorId=?
)
or workflowin0_.stepOperatorRange=13
and (
workflowin0_.operatorId=?
or workflowin0_.operatorId=?
)
) limit ?
------------------------------------------------------------------
this result "(entity.stepOperatorRange = 11 and entity.operatorId = ?)
or (entity.stepOperatorRange = 12 and (entity.operatorId = ? or entity.operatorId = ? ))
or (entity.stepOperatorRange = 13 and (entity.operatorId = ? or entity.operatorId = ? ))
)" is i wanted,but Hibernate generated is
" or workflowin0_.stepOperatorRange=12
and (
workflowin0_.operatorId=?
or workflowin0_.operatorId=?
) "
----------------------------------------------------------------------
this problem the same occurs with use "criteriaBuilder.or" funcation

Environment

hibernate4.3.8+hibernate-jpa-2.1.api +mysql5.6.20+bonecp0.8.0.RELEASE+spring4.1.4+jdk1.7+tomcat7.0.47

Status

Assignee

Unassigned

Reporter

zhaochunhui

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.8

Priority

Major
Configure