-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping of a Class containing a subClass
PostPosted: Wed Sep 27, 2006 5:50 am 
Newbie

Joined: Thu Oct 20, 2005 10:02 am
Posts: 3
Location: Belgium, Brussel
Hello,

I have a Child Class with some attributes.
This Child Class is an attribute of a Parent Class.
Quite simple ;-)

I'd like to make reference to an attribute of the Child Class in the mapping of my Parent Class, without having to use association.

Can I make something like this ?
Code:
<hibernate-mapping package="com.cwsoft">
   <class name="Parent" table="TAD01">
      <id name="entity" type="string" column="CODETT">
         <generator class="assigned"/>
      </id>
      <property name="enfant.entityType" column="TYPETT" type="string" />
    </class>
</hibernate-mapping>


Thanks in advance.

_________________
bgOnline


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 10:51 am 
Newbie

Joined: Wed Sep 27, 2006 1:15 pm
Posts: 10
You can use component:

Code:
<hibernate-mapping package="com.cwsoft">
   <class name="Parent" table="TAD01">
      <id name="entity" type="string" column="CODETT">
         <generator class="assigned"/>
      </id>
      <component name="enfant" class="Child" >
          <property name="childProperty" type="integer">
              <column name="prop1" sql-type="integer"/>
          </property>
          <property name="childProperty2" type="string">
              <column name="prop2" sql-type="varchar" length="32"/>
          </property>
      </component>
    </class>
</hibernate-mapping>


http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#mapping-declaration-component


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

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.