You'll need to create an intermediate entity, and one-to-many relationships to it from the School and Student classes.
Diego On Fri, Mar 12, 2010 at 12:08, tqwhite <[email protected]> wrote: > Is that a good way to title this? Do we have a better name for that > object that has both foreign keys? > > Anyway, I am using a set of externally designed data types. Among them > is the connection between two of my entities, Schools and Students. > Each student can attend many schools. Each school has many students. > In addition, that period of attendance has a start and end date, etc. > > I have constructed a mapping and it almost works. Two problems I need > help with: > > 1) I am getting an error, "Cannot insert the value NULL into the > column RefId." It specifies the join table. RefId is the <id> column > for this intermediate. I bet that the problem is that NH doesn't > expect there to be an id on the joining table. > > 2) I can't set said start and end dates because I can't find a way to > address that intermediate object. > > I considered the idea that I should initialize that object in the > AddStudent() (and AddSchool()) method but the needed id keys don't > exist yet. > > I spent last night poring over my brand, new copy of NHibernate in > Action (I LOVE THAT BOOK!), but can't find any advice. > > Help! Please. > > thanks, > tqii > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
