0

I have an existing criteria to which I want to add one more criterion that ORs with the preexisting criteria. I'd like to add that I cannot control how the preexisting criteria is constructed.

For eg: My preexisting criteria translates to the following SQL: select * from users where status = 'ACTIVE' and acctId = xyz

I want to add a criterion which would change this query to select * from users where (status = 'ACTIVE' and acctId = xyz) or deptId = abc.

I am unable to find a way to modify the exitsing criteria to become part of a disjunction.

My object looks like: User{Long userId, String status, Long acctId, Long deptId}

Any pointers appreciated.

Thanks, W

woggle
  • 11
  • 2
  • I guess you need to take a look at http://stackoverflow.com/questions/8126589/hibernate-criteria-restrictions-and-or-combination – Balwinder Singh Sep 15 '15 at 00:15
  • Like i mentioned - i donot have control over the created criteria. My problem is i need to either modify an existing criteria or get criterions from the preexisting criteria to create my own criteria - both of which i am unable to find a way to do. – woggle Sep 15 '15 at 00:19
  • I can haz code being used pls? :) – Brad Sep 15 '15 at 05:34

0 Answers0