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: components versus value types
PostPosted: Fri May 09, 2008 5:02 pm 
Newbie

Joined: Thu Oct 25, 2007 3:34 pm
Posts: 1
I'm working my way through JPA in Action.

I have a question about the difference between value types and components. The book says things like a value type depends entirely on an entity for its lifecycle, and that no other entity holds a reference ( a field reference i assume ) to the value type candidate.

With this understanding, I have decided that, in my own domain model, that an event in a calendar, is a value type. I have a user defined class for CalendarEvent and it depends entirely upon its association with a given Calendar.

But is it a component. The book's language makes components sound just like value types. Describing a component as something participating in "composition". By my understanding of composition, the CalendarEvents have this relationship to a Calendar. Like wheels to a car, for instance.

However, components are mapped in hibernate to columns in the "owning" entities table. This will clearly not work for events in a calendar, due to the fact that there can be many of them.

I'm looking for some semantic illumination. Please advise.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 12, 2008 3:16 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
You've got it all correct, but you have to notice the line between components that are part of the owning entity and collections of components. The latter looks (relationally) like any other FK relationship. It is Hibernate that defines the lifecycle and imposes query constraints that cause them to behave like the former. Does that make sense?

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


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.