Hi Oscar
You raise a very valid point which I had not considered.  I agree that
keeping the mapping simple does allow me to do queries like you had brought
up.  In addition, if I were to add addiitonal attributes (like num of yards
etc.), it would be much simpler.

Thanks for your suggestion.  I will go with the KISS principle...
Ramana

On Tue, Mar 17, 2009 at 3:42 AM, Oskar Berggren <[email protected]>wrote:

>
>
>  2009/3/16 Ramana Kumar <[email protected]>
>
>> 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
>>
>
>
> I don't quite see why you are trying so hard to avoid that. Seems to me you
> are actively trying to do it the "wrong" way, and because of that only
> making things more difficult. Now I'm not familiar with what kind of queries
> you would like to run, but if you would for example like to select all
> courses with at least three holes with par 5, in option 1 this is a simple
> "join, group by ... having ..." query, but in option 2 it seems to me you
> have much more work to do. You would have to spell out each par-column and
> then count them in some way. Can't think of how right now.
>
> Maybe this example won't happen in real life, but my point is that option 1
> is more flexible and feels more right, and appears easier to implement.
>
> I've seen systems implemented according to option 2 before. Not pretty...
> E.g. a "control unit" can control at most four objects, so let's have
> UNIT(ID, OBJ1, OBJ2, OBJ3, OBJ4) and now we have to write all queries like
> WHERE OBJ1=x OR  OBJ2=x OR OBJ3=x OR OBJ4=x. Imagine what that would be with
> 18 OBJ... :)  Btw... that system has been rewritten now.
>
> Regards,
> Oskar
>
>
>
>>   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
-~----------~----~----~----~------~----~------~--~---

Reply via email to