-->
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.  [ 7 posts ] 
Author Message
 Post subject: can a component get its parent type
PostPosted: Fri Nov 21, 2003 6:38 am 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
is it possible for a component to have a reference to its parent object?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 6:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
yep. even a composite-element.

check out the <parent> tag


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 6:59 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
gavin wrote:
yep. even a composite-element.

check out the <parent> tag


Hey hey - this is very cool Gavin...
Unfortunately, it doesn't seem to be mentionned in the doc (currently reading the one that comes with 2.1-b6) - or am I looking at the wrong place ?

(but is actually defined in the DTD)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 7:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Its there:
Code:
        <para>
            The <literal>&lt;component&gt;</literal> element allows a <literal>&lt;parent&gt;</literal>
            subelement that maps a property of the component class as a reference back to the
            containing entity.
        </para>

        <programlisting><![CDATA[<class name="eg.Person" table="person">
    <id name="Key" column="pid" type="string">
        <generator class="uuid.hex"/>
    </id>
    <property name="birthday" type="date"/>
    <component name="Name" class="eg.Name">
        <parent name="namedPerson"/> <!-- reference back to the Person -->
        <property name="initial"/>
        <property name="first"/>
        <property name="last"/>
    </component>
</class>]]></programlisting>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 7:45 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Grrr... indeed, but not obvious to find, you must agree...

To be honest, I like the section 4.1.2 hibernate-mapping where you give kind of synopsis of all types of mapping. In this section you have a component part where you describe part of the properties...

Unfortunately, the parent property is not mentionned.

Don't you think it would be a good idea to add it there as well ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 7:59 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Added this to the basic section

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2003 8:05 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Wouah !
Who ever said you don't get support for open source projects ;-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.