Hi
I have a table which has columns "attribute_name" and "attribute_value"; and I have a hibernate xml file having the mapping to "attribute_name" with attributeName and to the "attribute_value" with attributeValue. The "attribute_name" or attributeName has values like "x-VormID" and "Object Type", and the "attribute_value" or attributeValue has the values like "EF60E50CD06E3238DC04" and "PrivateKey".
Therefore I have the following loop trying to get result: Criteria criteria = session.createCriteria(KeyInfoDTO.class); // "keyAttributes" is the set defined in a hibernate xml file for KeyInfoDTO.class Criteria keyAttrCriteria = criteria.createCriteria("keyAttributes"); Iterator itnvs = nameValuePairs.keySet().iterator(); List<String> names = new ArrayList<String>(); List<String> values = new ArrayList<String>(); while (itnvs.hasNext()) { String name = (String) itnvs.next(); String value = (String) nameValuePairs.get(name);
keyAttrCriteria.add(Restrictions.eq("attributeName", name)); keyAttrCriteria.add(Restrictions.eq("attributeValue", value)); }
but keyAttrCriteria.list() or criteria.list() returned nothing. Any idea what's going on ?
Thanks in advance.
|