Quering and/or fetching map keys and values in HQL
Hibernate Criteria supports relation but not collection based conditions so we had to use HQL for this.
1
2 <class name="Asset" table="ASSETS">
3 <id name="id" column="AS_ID">
4 <generator class="native" />
5 </id>
6 <!-- ... -->
7 <map name="customAttributes" table="ASSET_CUSTOM_ATTRIBUTES_VALUES" lazy="true" sort="natural">
8 <key column="ACAV_ASID" />
9 <map-key-many-to-many column="ACAV_CAID" class="AssetTypeCustomAttribute"/>
10 <element type="string" column="ACAV_VALUE"/>
11 </map>
12 </class>
We wanted to keep the customAttributes collection lazy but pre-fetch for certain occasions, as well as query based on map key and value pairs. Here's an example of HQL used for searching:
1 select asset from Asset asset
2 left join fetch asset.customAttributes as customAttribute
3 where ((index(customAttribute) = ? and customAttribute = ?)
4 and (index(customAttribute) = ? and customAttribute = ?) )

Coach Outlet Online Build a network monitoring long-term mechanism of action to rectify the vigorous national network finally come to an end.
Posted by Coach Outlet Online on December 07, 2011 at 10:45 AM EET #
I was very pleased to find this site.I wanted to thank you for this great read!
Posted by Coach Outlet Store Online on December 08, 2011 at 09:27 AM EET #
It's good to see this information in your post
Posted by Coach Factory Outlet on December 14, 2011 at 10:41 AM EET #
Når nogen kommer til skobutik med henblik på at købe nogle behagelige og gode sko det første navn, <a href="http://www.nikefreerun3.net" title="nike free">nike free</a>
Posted by nike free on December 31, 2011 at 09:06 AM EET #
La Jordanie, qui est officiellement connu comme le Royaume hachémite de Jordanie est un pays qui est situé dans <a href="http://www.jordanchaussure.com" title="jordan chaussure">jordan chaussure</a>
Posted by jordan chaussure on December 31, 2011 at 09:09 AM EET #