Hi, I'm trying to order a list associated in a one-to-many association
to my main class.
We have this AmbulanceEvent class that can have multiple patients
associated to it.
Hoping to see a OrderBy attribute as part of the Mapping.

    [Class(Schema = Schemas.PCR, Table = "Event")]
    public class PcrEvent : BT.Ipwms.BO.BaseTimestampedObject
   .......
        [Bag(0, Inverse = true, Lazy = false, Cascade =
BT.Ipwms.BO.Hibernate.Cascade.ALL_DELETE_ORPHAN)]
        [Key(1, Column = "PcrEventId")]
        [OneToMany(2, Class = BT.Ipwms.BO.PCR.PcrPatient.TYPE_NAME)]
        public virtual IList<BT.Ipwms.BO.PCR.PcrPatient> PcrPatients
        .....

    [Class(Schema = Schemas.PCR, Table = "Patient")]
    public class PcrPatient : BT.Ipwms.BO.BaseObject
   .....
        [Property(Column = "PcrEventId", Type =
Hibernate.Mappers.BASE_OBJECT_ID, NotNull = true)]
        public virtual BT.Ipwms.BO.BaseObjectId PcrEventId
Note: we did not use the parent object here to reduce the
serialization costs. This is the parent key instead.

Also tried the session.Get method for the object and switched to a
Criteria, but also, no change in sort order.
            IList events = uow.Session.CreateCriteria(typeof
(PcrEvent))
                .CreateAlias("PcrPatients", "PcrPatient")
                .Add(Expression.Eq(PcrEvent.F_ID, Id))
                .AddOrder(Order.Asc("PcrPatient.FamilyName"))
                .AddOrder(Order.Asc("PcrPatient.GivenName"))
                .List();

Does anyone know of a way in NHibernate where we can get the patient
list under the event to be in a particular sort order.

Thanks in advance
Karl

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