-->
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: Collection of components
PostPosted: Wed Jun 15, 2011 4:33 am 
Newbie

Joined: Wed Jan 06, 2010 4:15 am
Posts: 3
Hi Friends,

I was reading the section "Collections of components" in chapter 6 "Mapping collection and entity associations" of the book "Java Persistence with Hibernate" by Gavin King and Christian Bauer. I had a query in this section.

This section says "You could map image as an entity class and create a one-to-many relationship from Item to Image. However this isn't necessary, because Image can be modeled as a value type: Instances of this class have a dependent life cycle, don't need there own identity and don't have to support shared references".

Furthermore its says, "Image is a component of Item, and Item is entity that is responsible for the life cycle of Image instances. The multiplicity of the association further declares this association as many - valued i.e, many (or zero) Image instances for the same Item instance".

These 2 explanations are fine. I have some questions here :

1) Is Image a component OR is Image a value type?

2) What is the difference between components and value types ? Isn't component and value types same? Shouldn't we map the collection of components and collection of JDK value types as same? I know the difference between entity and value type. Why is <composite-element> tag introduced instead of already existing tag <element> used for value type ?.

3) What is the difference between Collection of components and Collection of JDK value types? - 6.2.2 (Java Persistence with Hibernate).

In the User and Address example in Mapping Components section in the chapter "Mapping persistence classes" in the same book would we call Address as a component OR Address as a value type? There address is taken as a component and shown to be mapped as such.

Please do resolve my queries and help me in clearing my concepts. Any help would be highly appreciated

Thanks in advance.

Thanks and Regards,
Sid.


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.