Vekaz,

1. You first have to try a design before deciding for something more
complicated because of performance issues you can't measure or describe
2. There is no inheritance in the proposed model
3. <any> has its own problems, and, in this case in particular, I don't
think it's the best fit, as the relationship would be on the Note side, not
on the entity, so it's not easy to retrieve all the notes for an entity,
whereas the other model allows for navigation.
4. You write the mappings once (and you can get a tool like ConfORM to do
most of the heavy lifting), but you use the model in many places. So it's
the model what needs to be simple and easy to use, not the mappings (which
are there to abstract the complexity of the relational implementation)

    Diego


On Tue, Jul 13, 2010 at 08:44, Vekaz Turković <[email protected]> wrote:

> @Peter
> Maybe this will help:
> http://ayende.com/Blog/archive/2006/06/05/NHibernatesAssociationIsCool.aspx
> It's a bit dated but I guess it's still relevant.
>
> @Diego
> Nothing in particular, Diego. I don't know much about db/nhib performance,
> but from what I hear, having as many relationships as that design suggests,
> on the most frequently used tables, might cause performance issues. And,
> IIRC, I read somewhere that when working with inheritance queries should be
> given more thought than 'regular' queries, and that design would have
> inheritance everywhere. Why chose design that implies more thinking? :)
> <any> seems much more simple. Again, that's what I remember hearing/reading
> and isn't necessarily true, so... Feel free to educate me ;)
>
> On Tue, Jul 13, 2010 at 8:37 AM, Kenneth <[email protected]> wrote:
>
>> Yes, as Fabio wrote, use the <any> tag
>>
>> /K
>>
>> On Jul 13, 7:37 am, Peter Forstmeier <[email protected]>
>> wrote:
>> > Hi all,
>> > i follow this thread because i'm very interested on the same subject.
>> > I didn't see any solution right now. Did i miss something.
>> >
>> > Peter
>> >
>> > On 12 Jul., 13:53, Diego Mijelshon <[email protected]> wrote:
>> >
>> > > Uh?
>> >
>> > > What performance problem are you worried about exactly?
>> >
>> > >     Diego
>> >
>> > > On Sun, Jul 11, 2010 at 22:50, Vekaz Turković <[email protected]>
>> wrote:
>> > > > Thank you Diego, I was afraid this will end up unanswered :) That
>> was one
>> > > > way I considered doing it, but there's also Activities who are,
>> > > > relationship-wise, the same as notes. Both Notes and Activities will
>> most
>> > > > probably hold a lot of data. I am afraid that, with so many
>> relationships,
>> > > > performance might become an issue pretty soon. Would it be possible
>> to use a
>> > > > denormalized database; Note would hold type and id of the entity it
>> is
>> > > > attached to?
>> >
>> > > > On Sun, Jul 11, 2010 at 11:43 PM, Diego Mijelshon <
>> [email protected]>wrote:
>> >
>> > > >> This was discussed last month (
>> > > >>
>> http://groups.google.com/group/nhusers/browse_thread/thread/973df7dce...)
>> > > >> and it is certainly on topic :-)
>> >
>> > > >> In short: the model is simple. Several classes have a collection of
>> notes
>> > > >> (or, more precisely, a List, because the order probably matters).
>> You could
>> > > >> create an interface (IHaveNotes) to deal with this in your code and
>> make it
>> > > >> easy to add/retrieve notes from any entity.
>> >
>> > > >> Then, you have at least two possible ways to map this:
>> > > >> - Note is a component type, there is one table per Notes collection
>> > > >> - Note is an entity, there is one table for the Notes and a
>> many-to-many
>> > > >> table per each collection, mapped with cascade="all-delete-orphan"
>> >
>> > > >> Note that the data implementation should NOT change your model.
>> It's
>> > > >> always an IList<Note>.
>> >
>> > > >>     Diego
>> >
>> > > >> On Sun, Jul 11, 2010 at 08:01, moohzor <[email protected]> wrote:
>> >
>> > > >>> Hi,
>> >
>> > > >>> This isn't strictly nhibernate related, but I thought this would
>> still
>> > > >>> be the right place to ask.
>> >
>> > > >>> I have a Note entity, related to almost all other entities (you
>> can
>> > > >>> attach a note to pretty much anything else). All these entities
>> have a
>> > > >>> property to hold a collection of notes (but notes don't have to
>> have
>> > > >>> reference to the entity they're related to). I don't know how to
>> best
>> > > >>> model this in the database and map in hbm. How would you do this?
>> >
>> > > >>> Thanks in advance.
>> >
>> > > >>> --
>> > > >>> 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]>
>> <nhusers%[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]<nhusers%[email protected]>
>> <nhusers%[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]<nhusers%[email protected]>
>> <nhusers%[email protected]<nhusers%[email protected]>
>> ­>
>> > > > .
>> > > > For more options, visit this group at
>> > > >http://groups.google.com/group/nhusers?hl=en.-Zitierten Text
>> ausblenden -
>> >
>> > > - Zitierten Text anzeigen -
>>
>> --
>> 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]<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.

Reply via email to