Hibernate version:3
In my current app, I have a loop that builds a where clause in HQL. Here it is.
Code:
for (int i = 0;i<hmembpList.size();i++){
HQL_STMT = HQL_STMT + " tdocumtBean.xdact =? AND tdocumtBean.xdpat = ? OR ";
HmembpBean hmembpBean = (HmembpBean) hmembpList.get(i);
findObject[x] = hmembpBean.getAcct();
x++;
findObject[x] = hmembpBean.getPat();
x++;
findType[y] = Hibernate.INTEGER;
y++;
findType[y] = Hibernate.INTEGER;
y++;
}
Now, I am trying to move this code from Hibernate 2.1.7 useing a session.find to Hibernate 3 using a session.createCriteria. As you can see, I have both "and" and "or" (disjunction) in this HQL. How would I build this using the createCreiteria dynamically? I do not know how many Restrictions I may have. From the looks of the doc, I need to know this in order to code it correctly. Am I missing something here?