<< I know how to design the database but no sure how to map the classes to it>> (assuming you're not sitting on a legacy db...) Try to think the other way around. Don't design your db schema and "map classes to it". Design your model and let the db scheme suit your needs. I would recommend you to design your domain model and let nh create your db scheme. 95% (depending on your dba :)) of the time this works fine, some exotic cases you fix by manually written scripts.
<<I have a many-to-many relationship between a Horse entity and a Race entity, and they are both mapped properly with many-to-many relationships in both classes. The problem is that for each entry in the HorseRaces table (join table) there are specific fields, ie: the jockey and the position the horse came and the time etc. that can't be held in either of the classes, but can only be determined by the combination of the two! How would I map this to classes with nHibernate? The only way I could think of is to create a new object to hold these fields?>> Yes, that's the most straight forward would I guess. Instead of having a many-to-many relationship, use two one-to-many pointing to this entity in between. /Roger -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Robert Sent: den 10 september 2009 10:30 To: nhusers Subject: [nhusers] Join Table Properties Hi there, Still new and still learning nHibernate as well as proper Domain Model pattern. I'm struggling with a concept here. I know how to design the database but no sure how to map the classes to it, or even how to make the correct classes for nHibernate OR the terminology with which to search for solutions for my problem! I could do it by hand but not using nHibernate. The situation is as follows: I have a many-to-many realtionship between a Horse entity and a Race entity, and they are both mapped properly with many-to-many relationships in both classes. The problem is that for each entry in the HorseRaces table (join table) there are specific fields, ie: the jockey and the position the horse came and the time etc. that can't be held in either of the classes, but can only be determined by the combination of the two! How would I map this to classes with nHibernate? The only way I could think of is to create a new object to hold these fields? Please, any advice or best practices would be much appreciated. Would hate to give up on nHibernate for this project now. I'm SURE there's a 'PROPER' way to do this? Thank you in advance! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
