Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
trunk/
Mapping documents:
Mapping.hbm.xml:
Code:
<class name="A">
<any name="Value" id-type="long" meta-type="String">
<meta-value value="type1" class="Type1"/>
<meta-value value="type2" class="Type2"/>
<meta-value value="type3" class="Type3"/>
<column name="value_type"/>
<column name="value_id"/>
</any>
</class>
<class name="Type1">...</class>
<class name="Type2">...</class>
<class name="Type3">...</class>
Problem:I want to define mapping of the types Type1, Type2, Type3 in a separate hbm.cml file since in my case types are not known at run time.
I checked documentation and examples / unit tests but nothing like this is available there.
In seems to be possible for <subclass> but not possible for <any> / <meta-value>, is there any way to do it? Basically I need something like:
Mapping.hbm.xml:Code:
<class name="A">
<any name="Value" id-type="long" meta-type="String">
<column name="value_type"/>
<column name="value_id"/>
</any>
</class>
Mapping1.hbm.xml:Code:
<extend-class name="A">
<any name="Value" id-type="long" meta-type="String">
<meta-value value="type1" class="Type1"/>
</any>
</extend-class>
<class name="Type1">...</class>
Mapping2.hbm.xml:Code:
<extend-class name="A">
<any name="Value" id-type="long" meta-type="String">
<meta-value value="type2" class="Type2"/>
</any>
</extend-class>
<class name="Type2">...</class>
Or is there any way to inject it at run-time?
I need it since my types are loaded from the plugins and mapping for them is not known at configuration time.
Thanks!