-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to map multiple tables with multiple indexes?
PostPosted: Wed Mar 21, 2007 7:16 pm 
Newbie

Joined: Wed Mar 21, 2007 1:43 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.