If the many-to-many association you are describing is also
bidirectional, then I recommend that you:
  (1) Download and compile the current NH trunk, which is version
2.1.0.Alpha1.
  (2) Refer to this documentation to see how to do the mapping:
    
http://www.hibernate.org/hib_docs/v3/reference/en/html/collections-advancedmappings.html#collections-indexedbidirectional

I recommend using the trunk because, prior to NH v2.1.0.Alpha1, there
was an issue with this scenario:
  http://jira.nhibernate.org/browse/NH-298
It's apparently now resolved, although it could use some further user
verification.

In spite of that issue, this scenario was still possible with earlier
versions of NH, i.e. version 1.2, in which case you can look here:
  http://www.hibernate.org/193.html
But with the trunk you'll get more efficient updates of sibling
indices, and you'll eventually upgrade anyway, so why not just go with
that.


On Jan 7, 4:02 pm, Todd <[email protected]> wrote:
> I have a product object that has the usual properties like ID, name,
> etc.  and a ContentBlock object which has an ID, a Name and a Content
> property which represents a block of HTML.  These two objects have a
> many-to-many relationship as a product has multiple content blocks,
> and content blocks can be shared amongst products.
>
> An important distinction is that when getting the collection of
> content blocks for a product, the order of the objects in the
> collection is important and must be maintained when object state is
> persisted.  Is there an easy way to map this in nHibernate so that the
> index of the item in the list (or set or whatever) is saved in the
> database as a "sortorder" column?  Or, should I just add another class
> to my domain that keeps the order and resolves the many-to-many
> relationship between the product and contentblock classes?
>
> Thanks,
> Todd
--~--~---------~--~----~------------~-------~--~----~
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