Hallo,

Can anyone tell me if it is possible to use <any> Hibernate type mapping 
between Entities or use any other way to accomplish this?

I want to use a central "textnote" Entity and connect it to several other 
Entities in my project to give any of them the possibillity to have 0-n 
textnotes attached.

With hand written hbm files i would do it this way:
<hibernate-mapping ....>
  <class name="Textnote" table="TEXTNOTE" >
    <meta 
attribute="session-method">at.ids.hibernate.util.HibernateUtil.getSession();</meta>
    <id name="id" type="long" column="TEXTNOTE_ID" unsaved-value="0">
      <generator class="native"/>
    </id>        
    <any name="parent" meta-type="string" id-type="long" >
      <meta-value class="AAA"        value="AAA" />
      <meta-value class="BBB"        value="BBB" />
      <meta-value class="CCC"        value="CCC" />
      <column name="FK_TYPE" length="4"/> <!-- AAA, BBB,.... -->
      <column name="FK_ID"/>
    </any>
    <property name="note"  type="string" not-null="true"/>
  </class>

  <class name="aaa" table="AAA" >
    <meta 
attribute="session-method">at.ids.hibernate.util.HibernateUtil.getSession();</meta>
    <id name="id" type="long" column="AAA_ID" unsaved-value="0">
      <generator class="native"/>
    </id>               
    <set name="notes" lazy="true" inverse="true">
      <key column="FK_ID"/>
      <one-to-many class="Textnote"/>   
    </set>    
  </class>
  <class name="bbb" table="BBB" >
    <meta 
attribute="session-method">at.ids.hibernate.util.HibernateUtil.getSession();</meta>
    <id name="id" type="long" column="BBB_ID" unsaved-value="0">
      <generator class="native"/>
    </id>               
    <set name="notes" lazy="true" inverse="true">
      <key column="FK_ID"/>
      <one-to-many class="Textnote"/>   
    </set>    
  </class>
</hibernate-mapping>


Mit freundlichen Grüßen
 

--------------------------------------------------------------------------------
 
Ing. Michael Chytracek  
Senior Consultant  


IDS Scheer Austria GmbH / Modecenterstrasse 14 / A - 1030 Wien 
Phone: +43 1 79566-18054 / Fax: +43 1 79566-444 / Mobile: +43 676 8909 80 54 
Email: <[EMAIL PROTECTED]>/ Internet: <http://www.ids-scheer.com/>

IDS Scheer Austria GesmbH 


Business Process Excellence 


SAP Global Services Partner 
 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to