Hi!
I'm having difficulty in designing a good mapping for a particular class I've used in the past. The problem class is called
Document which amongst other things has a hashmap of language codes to
Body's.
My problem is replicating the keys in hibernate. A
Body contains a particular translation of the
Document and a
Language and I want to use the body.language.code as the key.
I've tried the following two index settings...
Code:
<map name="bodies">
<key column="documentId"/>
<index column="language" type="Language"/>
<one-to-many class="Body"/>
</map>
Code:
<index column="language.code" type="String"/>
In the first example I was happy for the key to be a
Language object instead of a String but I ended up with serialized languages in my bodies table.
I didn't expect the second example to work but maybe shows what I'm after :-)
Is it possible to achieve the mapping I'm after or is there another way I could think about the problem?
Thanks.