Hibernate version: 3.0beta3
Hi.
The <join> element currently does not support a <map> element beneath it and I was wondering if there is a reason this is so. I have the following use case, under which I believe such an option would make sense:
I have a cms, where the users can dynamically add new mappings at runtime. The new mappings fall under a parent subclass (a generic "node") which can result in a very wide tree. For this I made the new mappings use a <join> with fetch="select", so I can use a discriminator instead of endless sql joins.
The users can define new types of content and they have an option for making the fields localized. Those fields are actually stored in an external table and fetched using a Map.
Currenlty, I have placed a <dynamic-component> under the <join> and place the maps in there, like this:
Code:
<subclass name="eg.dynanodes.News" discriminator-value="DYNA_NEWS">
<join table="NODES_NEWS" fetch="select">
<key column="UUID"/>
<property name="date" type="java.util.Date" column="DATE"/>
<dynamic-component name="i18n">
<map name="title" table="NODES_NEWS_TITLE" lazy="false" cascade="all-delete-orphan">
<key column="UUID"/>
<index column="LANG_ID" type="integer"/>
<element column="VALUE" type="string" length="128"/>
</map>
</dynamic-component>
</join>
</subclass>
(Actually I dont have mappings anywhere, I never generate them in xml and instead manipulate the mappings at runtime, but this is what it would be like)
However it would be more intuitive if the <map> element could be placed directly under the <join>. I think it might be a useful feature (as well as other collections too)
Alex