++1 on that explanation

In fact, you should make that an addendum to the "I believe you are
'mistaken' sir" that so many of us have scratched our thick heads at
the first time round.

Seriously, Sir!!

On Jan 20, 1:33 pm, Hudson Akridge <[email protected]> wrote:
> It's a many-to-one, not a one-to-many that the article was recommending.
> Which is References() in FNH lingo. That is what you need. Even though you
> believe it to be a one-to-one, because there's only ever one of B class to
> associate to A, it's still a many-to-one. The naming of that class is not
> the best imo, and many of us that are more familiar with database ERDs get
> the terminology screwed up. Forget everything you know about database and
> object mapping terminology. This is NHibernate terminology, it doesn't
> always correlate correctly with what common logic would dictate from other
> environments.
>
> A one-to-one mapping is so rare, I have not even once seen someone in my
> career use one correctly. I'm not saying you might not be the exception, but
> I believe that to be unlikely. You want a simple many-to-one (References())
> from your User to your UserPreferences. Set the cascade on it to
> AllDeleteOrphan() and you are officially good to go. UserPreference will
> never know about which user it's associated to, but user will have the
> single reference to which UserPreference it needs to load.
>
>
>
> On Wed, Jan 20, 2010 at 3:02 PM, Brian Kendig <[email protected]> wrote:
> > On Jan 20, 3:57 pm, Brian Kendig <[email protected]> wrote:
> > > On Jan 20, 3:52 pm, Hudson Akridge <[email protected]> wrote:
>
> > > > I'm going to find a way to sticky Jame's post here:
> >http://blog.jagregory.com/2009/01/27/i-think-you-mean-a-many-to-one-sir/
>
> > > > <
> >http://blog.jagregory.com/2009/01/27/i-think-you-mean-a-many-to-one-sir/
> > >Google
> > > > Groups really needs stickies ;)
> > > > (Read that article please)
>
> > > Thank you for the link. I read that article earlier, but I don't
> > > believe it applies to my situation.
>
> > Okay - before you answer, I gave the article a re-read, and I
> > understand what it's trying to say. I thought its point was "you think
> > your relationship is one-to-one, but it's really one-to-many". I see
> > now that its point is "you're trying to set up one-to-one, but you're
> > accidentally setting up one-to-many".
>
> > From the "One-to-one" section of that article I see how it says I
> > should be setting up this relationship; but I don't understand how to
> > represent that in Fluent NHibernate. I'm still up against the problem
> > that when one object tries to create another, it's not saving that
> > object.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<fluent-nhibernate%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --
> - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.

Reply via email to