These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Multiple same propertyName compare against different values
PostPosted: Wed Aug 24, 2011 5:13 pm 
Newbie

Joined: Wed Aug 24, 2011 4:42 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.