Rui,

I could be way off, but my thinking is that your looking to map a
collection and within that you could use the order-by argument on the
element.  I would look at section 6.2 of the documentation.  I
personally use the <bag> element however I am not using the order-by
so I can't vouch that it works but I would assume it does.  You may
also use the sort, but I don't know how that sorts it, you would have
to experiment.

I would *think* your mapping would look like this:

<bag name = "Segments" table="RouteSegment" order-by="order asc">
    <key column="id_route" />
    <many-to-many column = "id_segment" class ="[NameSpace].
[ClassName],[NameSpace]" />
</bag>

Hope that helps,
Josh

On Apr 13, 10:41 am, Rui Guimaraes <[email protected]> wrote:
> Hi,
>
> I am kind of new to nhibernate and would like to do something that
> should be rather simple, but I am not finding anything on how to do
> it. I know this is possible to do in other ORM's but I would like to
> use nhibernate to do this:
>
> Imagine I have a route defined by several segments in a certain order.
>
> Lets make it simple and have 3  tables in my DB:
>
> Routes:
> - id_route
> - route_name
>
> Segments:
> - id_segment
> - segment_name
> - begin_point
> - end_point
>
> and the auxiliar table:
> RouteSegment:
> - id_route
> - id_segment
> - order
>
> But now in my object world I only want to have only two classes: Route
> and Segment.
> And my Route class should have a ordered list of the segments I want.
>
> As far as I have read this is not possible and I should use another
> auxiliar class and make it a one to many relashionship, but this is
> not what I want, and I've seen this in other ORM's.
>
> Do you know how can I do it in nhibernate? In particular the mapping
> of the tables.
--~--~---------~--~----~------------~-------~--~----~
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