I have a query like
"select
this_.appNum as y0_
from
CoreApplication this_
inner join
LoanAndDeposit loananddep2_
on this_.appNum=loananddep2_.CoreApplication_appNum
inner join
OptionTrade optiontrad1_
on this_.appNum=optiontrad1_.CoreApplication_appNum
where
this_.applicationType in (
?, ?, ?, ?
)
and this_.status in (
?, ?, ?
)
and optiontrad1_.lastModifiedUser=?
and loananddep2_.status=? ".
For the last part i.e. OptionTrade.lastModifiedUser and LoanAndDeposit.status I have to do an OR instead of AND. These are generated by sub-Criteria objects are here's the code :
Code:
Criteria criteria = session.createCriteria(CoreApplicationModel.class);
criteria.setProjection(Projections.property("appNum"));
criteria.add(Restrictions.in("applicationType", appTypeParams));
criteria.add(Restrictions.in("status",statusParams));
criteria.createCriteria("optionTradeModels").add(Expression.eq("LastModifiedUser", "Anonymous"));
criteria.createCriteria("loanAndDepositModels").add(Expression.eq("Status", "Done"));
List objects = criteria.list();
I have an idea that this is done by Conjunction object but can anyone please tell me how in this case ? To rephrase the question how can I do an OR operation between two sub-Criteria s ? Please help.