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/973df7dce9c5e0dc/97d49dac7dc21f85?lnk=gst&q=notes#97d49dac7dc21f85)
> 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]>
>> .
>> 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