These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping <meta-value> for <any> in a separate hbm
PostPosted: Fri Apr 11, 2008 11:48 am 
Newbie

Joined: Fri Apr 11, 2008 10:05 am
Posts: 2
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.