A little behind on a reply to this... Yes, having two one-to-many's is the
recommended approach. By adding extra fields to your join table you're
effectively creating a new entity, the awkwardness you speak of is because
you're not thinking about it as an entity.

On Wed, Aug 5, 2009 at 4:59 PM, Brian Kendig <[email protected]> wrote:

>
> On Jul 21, 11:10 am, Hudson Akridge <[email protected]> wrote:
> > You'd want to create a third class for your "Pivot" data. [...]
> > Then map that as a HasMany() from both the User and the Message class.
> The
> > UserMessages would map back to the User and Message using a References().
> Be
> > sure to set .Inverse() on the HasMany() mapping.
>
> It's been two weeks, but I'm investigating this in more depth now.
>
> Are you saying, basically, that if I want additional data in a many-to-
> many relationship - like, many users to many messages, but each
> particular user-message relationship should have a 'Read' or 'Deleted'
> flag on it - that I should no longer think of this as a many-to-many
> relationship, but instead as a pair of one-to-many relationships?
>
> User --many--> UserMessages <--many-- Message
>
> That would be easy, because one-to-many relationships are simple to
> handle; but at the same time it abstracts things, because we're no
> longer thinking of a user having many messages and a message being
> sent to many users - now we're thinking of each having several
> UserMessage relationships, which seems a little awkward. I would loop
> through a User's UserMessages and do something with the Message
> attached to each, for example.
>
> If this is the right approach then I'm all for it - I just first
> wanted to make sure I'm not misunderstanding. Thank you!
>
> > For more in depth examples, check into how people map an "Orderline" in
> an
> > Orders/Parts scenario.
>
> I found some examples of people with questions about Orderlines, but I
> wasn't able to find any good examples of how people had implemented
> them.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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