Hibernate version: 3.2.4 sp1
- A device contains a list of records
Code:
Criteria criteria = session.createCriteria(Device.class);
for (Iterator iter = lstCriteria.iterator(); iter.hasNext();) {
MyCriteria myCriteria = (MyCriteria) iter.next();
criteria.createCriteria("records").add(
Expression.and(
Expression.eq("key", myCriteria.getKey()),
Expression.eq("value", myCriteria.getValue())
)
);
}
List<Device> results = criteria.list();
This code works only when lstCriteria contains 1 element.
How to do for making this code work whith multiple myCriteria inside lstCriteria ?
Any idea ?
Thanks.[/code]