Potential BUG in FieldKey.getDisplayName() or getDisplayID()

I found that both getDisplayName() and getDisplayid() return the same, regardless of if you have used the alias or not for the field name.

Here is my code:

FieldKey keys[]=this.getWeb_userDataProvider().getFieldKeys();

Option options[]=new Option[keys.length];

for (int i=0;i<keys.length;i++){

info("ID="+keys[i].getFieldId()+", Name="+keys[i].getDisplayName());

options[i]=new Option(keys[i].getFieldId(), keys[i].getDisplayName());

}

I tried to use it with and without the alias in the query:

Without alias:

SELECT last_name, first_name from user

With aias:

SELECT last_name AS "Last Name", first_name AS "First Name" FROM user

I was hoping that getDisplayId would give me "last_name" and getDisplayName() would give "Last Name". Turns out if you use without alias, both give "last_name" (rightly so) and if used with alias, they both give "Last Name". (BUG?)>

[1187 byte] By [Sabir] at [2007-11-26 9:50:15]
# 1

i have a similar problem... i get a different set of fieldkeys when deploying to the bundled sun-appserver and to my tomcat container...

they are accessing the same mysql database/server with the same drivers...

appserver shows field names with the correct aliases:

FieldKey[VIEW_PRODUCTS_SPECIFICATION.id] | FieldKey[VIEW_PRODUCTS_SPECIFICATION.name] | FieldKey[VIEW_PRODUCTS_SPECIFICATION.grade] | FieldKey[VIEW_PRODUCTS_SPECIFICATION.grammage] | FieldKey[VIEW_PRODUCTS_SPECIFICATION.color] | FieldKey[VIEW_PRODUCTS_SPECIFICATION.gradegroup]

tomcat does not:

FieldKey[ENTITY.id] | FieldKey[ENTITY.name] | FieldKey[SPECIFICATION.value] | FieldKey[SPECIFICATION.value] | FieldKey[SPECIFICATION.value] | FieldKey[PROPERTYRELATION.parent_value]

is there a way to handle this?

webhornetnet at 2007-7-7 1:00:49 > top of Java-index,Development Tools,Java Tools...
# 2
maybe of interest:i've got at last a solution for my problem: i used the buggy MySQL Connector/J 5.0 instead of the stable version 3.1...
webhornetnet at 2007-7-7 1:00:49 > top of Java-index,Development Tools,Java Tools...
# 3
I used bundled database. Do you get the same value of getDisplayName and getDisplayID or different?
Sabir at 2007-7-7 1:00:49 > top of Java-index,Development Tools,Java Tools...