Hi Fabio I looked up the NHibernate in Action and did a quick google search. I might be missing somthing obvious here....
If I use a list of components, the properties of the component (Par and Handicap) would end up in the child table. Which is what I am trying to avoid. Ramana On Mon, Mar 16, 2009 at 2:33 PM, Fabio Maulo <[email protected]> wrote: > list of <component> > > 2009/3/16 Ramana Kumar <[email protected]> > > Hi >> I have a mapping question and I could use some help >> >> In my GolfHandicapManager system, I have a domain object called Course. I >> want to have Par and Handicap assigned to each hole of the course (i.e hole >> 1 is Par 4 and Handicap 7, Hole 2 is Par 5 and Handicap 14 etc). I have the >> following options that I can think of. All typed from memory... >> >> Option 1 - Use List or Primitive-Arrays >> ============================== >> <list name="ParAndHandicaps" lazy="false" table="PAR_AND_HANDICAP" >> <key column="COURSE_ID"/> >> <index column="HOLE_NUM"/> >> </list> >> >> Table definition >> ============ >> COURSE (ROW_ID, NAME) >> PAR_AND_HANDICAP (ROW_ID, COURSE_ID, HOLE_NUM, PAR, HANDICAP) >> >> Pros - Mapping is pretty straight forward >> Cons - too normalized:-) I would ideally like to have the pars and >> handicap on the same table as course. Makes it easier to understand the >> table etc. >> >> Option 2 - Create additional properties in Course >> ==================================== >> Table Definition >> COURSE (ROW_ID, NAME, HOLE1_PAR, HOLE1_HANDICAP .... HOLE18_PAR, >> HOLE18_HANDICAP) >> >> Pros - All the information about the couse is in the same table >> Cons - Just does not feel correct :-), index operation is not possible. >> >> Since I know that there are exactly 18 holes in a course (I know that I >> have to sub-class a 9 hole couse too...), is there a way to map all the >> elements of the List on the parent table itself? >> >> Any thought on how to map it correctly? >> Thanks >> Ramana >> >> >> >> > > > -- > Fabio Maulo > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
