-->
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: Select query for collection type map
PostPosted: Tue Feb 21, 2012 2:35 am 
Newbie

Joined: Tue Feb 21, 2012 2:03 am
Posts: 1
Hi,

I have map file for

<class name="table1"
table="table1">
<id name="id" column="id" type="java.lang.Long">
</id>
<property name="deleted" column="deleted" />
<property name="externalId" column="externalId" />
<map name="properties" access="field" lazy="false" table="table1_properties">
<key column="table1_id" />
<index column="property_key" type="string" />
<element >
<column name="property_value" />
</element>
</map>
</class>

I have some function which want to check whether map which I will pass is there in database

Case 1: When I want to match all the key-value pair from map (size=2) which I pass as a parameter then my hql is as follows

select e.externalId from table1 e where e.deleted = ? and ( (e.attributes[?] = ?) and (e.attributes[?] = ?) ) .....this query works absoulutely correct

Case 2: When I want to match any of the key-value pair from map (size=2) which I pass as a parameter then my hql is as follows

select e.externalId from table1 e where e.deleted = ? and ( (e.attributes[?] = ?) or (e.attributes[?] = ?) ) .....I am not getting expected result for this query.

Can anybody tell me how my hql should look like for case 2??

Thanks,
Bhushan


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.