Hi all. I'm using NHibernate 1.2 RC1 on SQL Server 2005 and I'm having trouble on how to map what I perceive to be a slightly more than basic relationship.
The database tables relevant to my question look like this:
Player <--- Prediction ---> Source
Player (Id, Name, Age, Weight, etc)
Source (Id, Name)
Prediction (Id, PlayerId, SourceId, Year, AtBats, Hits, Walks, HomeRuns, etc)
Player is a list of baseball players.
Source is a list of publications that provide predictions about player's performance.
Prediction is a set of stats that a particular source provides for a given player and year.
So, in my code, I have an instance of a Player (e.g, Alex Rodriguez) and an instance of a Source (e.g., ESPN). I want to get the data from the Prediction for that Player and Source for a specific year. (e.g., How many home runs does ESPN predict Alex Rodriguez is going to hit in 2007?)
I'd like to be able to do something like: Player.Predictions[Source][2007] to get at my Prediction object full of data.
I have all the data, I have the database setup. But how would I map this? (Or better yet, how would you map this?)
I've figured out the basic mapping types but I've been completely confused by the more advanced types. Things like composite-index, index-many-to-many, etc. These just aren't explained anywhere in a way that I can understand.
Any help would be appreciated!
Thanks!
Andy
|