I didn't provide enough information. I get it.  I really do appreciate
everyone's contribution and have no problem having someone tell me
that I didn't provide enough enough.  Thanks for the patience.

problem: List isn't in the same order as if I run the same query in
query analyzer.

Here is the call to the named query..

  IList<FlexPropertyLibData> list = null;
            using (ISession session = _dlHelper.GetSessionForRead())
            {
                list = session.GetNamedQuery("GetFlexPropertyLibData")
                    .SetParameter("deviceId",
deviceDescriptor.LibraryId)
                    .List<FlexPropertyLibData>();
            }

Here is the mapping info. Note that all of the tables in the SQL query
are not mapped by NHibernate.  The only thing that I want out of it is
the result of the query, the "FlexPropertyLibData".  It's an ugly
query better served with a view but I am in the world of MsSqlCE so I
don't have a choice.

Thanks,
jeff

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="Crestron.Tools.TypeLib.PanelDesign.FlexPropertyLibData,
Crestron.Tools.TypeLib"
       >

    <id name="Id" column="PropertyID"  type="int"
access="field.camelcase-underscore">
      <generator class="native"/>
    </id>

    <property name="ElementId" type="String" length="16" />

    <property name="Name" type="String" length="60"/>

    <property name="ValueType" length="200" type="String" />

    <!-- String on the DBSide, Enum in class, note use of EnumMapper --
>
    <property name="PropertyState" length="20"
           type="Crestron.Tools.Core.PropertyStateEnumMapper,
Crestron.Tools.Core"/>

    <property name="PanelName" type="String" length="40" />
    <property name="ElementName" type="String" length="40" />

    <property name="Synchronize" type="Boolean"/>
    <property name="DefaultValue" type="String" length="100" />
    <property name="Description" type="String" />
    <property name="Regex" type="String" length="30" />
    <property name="Range" type="String" length="30" />
    <property name="IsRequired" type="Boolean" />
    <property name="ValueSetId" type="String" length="16" />
    <property name="CategoryId" type="String" length="16" />
    <property name="Seq" type="int" />

   </class>

  <sql-query name="GetFlexPropertyLibData"  read-only="true"  >

    <return alias="FlexPropertyLibData"
class="Crestron.Tools.TypeLib.PanelDesign.FlexPropertyLibData,
Crestron.Tools.TypeLib"/>

    select
    Panel_Object_Properties.PropertyID as Id,
    Panels.PanelName,
    objects.NameKey as ElementName,
    Panel_Object_Properties.NameKey as Name,
    Panel_Object_Properties.DisplayName,
    Panel_Object_Properties.ValueType,
    Panel_Object_Properties.PropertyState,
    Object_Map.ObjectID,
    Panel_Object_Properties.InitialValue as DefaultValue,
    Panel_Object_Properties.Show,
    Panel_Object_Properties.Synchronize,
    Panel_Object_Properties.[Description],
    Panel_Object_Properties.PropertyType,
    Panel_Object_Properties.ValueSetID,
    Panel_Object_Properties.CategoryID,
    Panel_Object_Properties.Regex,
    Panel_Object_Properties.[Range],
    Panel_Object_Properties.IsRequired,
    Panel_Object_Properties.Seq,
    Properties_Map.ObjectPropertyType,
    Object_Map.ObjectId as ElementId,
    Panel_Object_Properties.PropertyID,
    panels.DeviceId,
    Object_Map.MinFirmwareRevision as ElementMinFirmwareRevision,
    Object_Map.MaxFirmwareRevision as ElementMaxFirmwareRevision,
    Object_Map.MinPDReleaseRevision as ElementMinPdReleaseRevision,
    Panel_Object_Properties.[Insert],
    Panel_Object_Properties.Offset

    from Panel_Object_Properties
    inner join ((Panels INNER JOIN ((Object_Map INNER JOIN Objects ON
Object_Map.ObjectID = Objects.ObjectID) INNER JOIN Panel_Families ON
Object_Map.PanelFamilyID = Panel_Families.FamilyID) ON Panels.FamilyID
= Panel_Families.FamilyID) INNER JOIN Properties_Map ON
Object_Map.ObjectMapID = Properties_Map.ObjectMapID)
    ON Panel_Object_Properties.PropertyID =
Properties_Map.ObjectPropertyType
    where Panels.DeviceId = :deviceId and (objects.NameKey = 'AO' or
objects.NameKey='Border')
    order by ElementName, seq
  </sql-query>

</hibernate-mapping>






On Jun 2, 8:57 am, Fabio Maulo <[email protected]> wrote:
> 2009/6/1 Germán Schuager <[email protected]>
>
> > Hi,
> > I think that Fabio is saying is that you don't provide enough information
> > about your scenario (classes, mappings, test-case, etc.) for answering your
> > question.
>
> In this case :
> "I have a sql-query with a order by in the sql-query definition.  When I get
> the IList back it doesn't maintain the sorted order specified in
> the sql."
>
> Is the same of say:
> I have part of my code that is not working properly. Which is the problem ?
> Should I do something else ?
>
> @Jeff
> Try to give an answer to my question.
>
> --
> Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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