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.
|