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
|