-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Alphabetic order entity class properties in IList Quickwatch
PostPosted: Wed Jun 13, 2007 12:26 am 
Newbie

Joined: Sat Jun 09, 2007 9:40 am
Posts: 11
What controls the way the IList results properties are positionally ordered?

A quickwatch of of people shows an array of Person types. The order of the elements are in the type are:

age
Age
loginId
LoginId
name
Name
sex
Sex

Why are they in alphabetic order and not in the order of the Person.cs class?

When I bind people to a DataGridView the columns are in this order:

Sex, Name, Age, Login Id

The sql db table column order is LogonId, Name, Age, Sex as is the order of the Person.cs below?

I'd like to see the quickwatch in the order the properties appear in the class.

How can I control the order the results appear in?


IList people = session.GetNamedQuery("spPerson")
.SetMaxResults(50)
.List();

ListPeopleDataGridView.DataSource = people;

using System;

namespace NHibernate.Examples.QuickStart
{
public class Person
{
private string logonId;
private string name;
private string age;
private string sex;

public Person()
{
}

public virtual string LogonId
{
get { return logonId; }
set { logonId = value; }
}

public virtual string Name
{
get { return name; }
set { name = value; }
}

public virtual string Age
{
get { return age; }
set { age = value; }
}

public virtual string Sex
{
get { return sex; }
set { sex = value; }
}

public override bool Equals(object obj)
{
return base.Equals(obj);
}

public override int GetHashCode()
{
return base.GetHashCode();
}
}
}


<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="NHibernate.Examples.QuickStart.Person, NHibernate.Examples" table="person">

<composite-id access="field">
<key-property name="LogonId" column="LogonId" type="String" length="10"/>
<key-property name="Name" column="Name" type="String" length="40" />
</composite-id>

<property name="Age" type="String" length="10"/>
<property name="Sex" type="String" length="1"/>
</class>

<sql-query name="spPerson">
<return alias="person" class="NHibernate.Examples.QuickStart.Person, NHibernate.Examples" />
SELECT * FROM person
</sql-query>

</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.