-->
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.  [ 3 posts ] 
Author Message
 Post subject: Component vs dynamic-component
PostPosted: Thu Aug 12, 2010 5:44 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Hi All,

Can any one highlight me the differences between these elements component & dynamic-component in order to understand clearly.

If any one explain me with simple mapping document it would be helpful.

thanks!


Top
 Profile  
 
 Post subject: Re: Component vs dynamic-component
PostPosted: Thu Aug 12, 2010 6:04 am 
Beginner
Beginner

Joined: Sat Nov 19, 2005 11:54 am
Posts: 22
The <component> element maps properties of a child object to columns of the table of a parent class. Components can, in turn, declare their own properties, components or collections

The <dynamic-component> element allows a Map to be mapped as a component, where the property names refer to keys of the map

example of dynamic-component:
Code:
<dynamic-component name="userAttributes">
    <property name="foo" column="FOO" type="string"/>
    <property name="bar" column="BAR" type="integer"/>
    <many-to-one name="baz" class="Baz" column="BAZ_ID"/>
</dynamic-component>


example of component
Code:
<class name="eg.Person" table="person">
    <id name="Key" column="pid" type="string">
        <generator class="uuid"/>
    </id>
    <property name="birthday" type="date"/>
    <component name="Name" class="eg.Name"> <!-- class attribute optional -->
        <property name="initial"/>
        <property name="first"/>
        <property name="last"/>
    </component>
</class>


Top
 Profile  
 
 Post subject: Re: Component vs dynamic-component
PostPosted: Thu Aug 12, 2010 6:14 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Thanks for ur response.

Have few questions.

1) How declaring Name class in different hbm is different from declaring here as component.
2) Here how the properties present in component are accessible from Person entity ?


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