Hi,
I have a mapped Map containing properties of my User object which I can access in Java with User.getChoiceProperties() and this works fine.
Now I would like to select all distinct combinations of (map key, map value) on all users and fail finding the right expression.
I've tried
Code:
select u.choiceProperties.indices, u.choiceProperties.elements from User u
but it's not the right query as it makes 2 joins on the properties table.
In SQL it would be quite easy:
Code:
SELECT DISTINCT name, value
FROM `users_choiceprops`
Hibernate version: 2.1.7
Mapping documents:Code:
<class name="User" table="users" ....>
...
<map name="choiceProperties" table="users_choiceprops"
lazy="false" sort="unsorted" inverse="false" cascade="none">
<key column="user"/>
<index column="name" type="string"/>
<element column="value" type="string" not-null="false" unique="false"/>
</map>
...
</class>