This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 199301 - Column names order when creating a table
Summary: Column names order when creating a table
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 09:31 UTC by yohan_fernando
Modified: 2016-07-07 08:53 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yohan_fernando 2011-06-09 09:31:56 UTC
Hi 

When I create a table using JPA and java Entities, they seems to be ordering the column names based on alphabetical order rather than the actual sequence they appear in teh entity. This is really annoying when it come to debugging etc! 

Am I doing something wrong or is there some sort of error. This wasnt the case in Netbeans 6.8/9 which I used to use before.

please help.

Thanks
Yohan
Comment 1 Sergey Petrov 2011-06-09 10:13:56 UTC
If it's an issue it may be an issue in eclipselink(or whatever provider you use), and may be some change between previous version and current one(2.2).
Provider is responsible for db manipulations (tale creation/persist data etc.).
You may want to ask a question or file an issue against eclipselink.
Comment 2 yohan_fernando 2011-06-09 13:28:45 UTC
I think it's a problem with eclipselink as well, or how netbeans assign the weigth for each field.

I found a workaround by implementing a Descriptor customizer and assigning weight to each field in the sequence they should appear. See below, if any one strolls upon this.

package xxxxx;

import org.eclipse.persistence.config.DescriptorCustomizer;
import org.eclipse.persistence.descriptors.ClassDescriptor;

public class MyCustomiser implements DescriptorCustomizer {

    @Override
    public void customize(ClassDescriptor descriptor) {
            descriptor.setShouldOrderMappings(true);
            descriptor.getMappingForAttributeName("Id").setWeight(1);
            descriptor.getMappingForAttributeName("CustName").setWeight(2);
            descriptor.getMappingForAttributeName("Address").setWeight(3);
            descriptor.getMappingForAttributeName("Tel").setWeight(4);
            descriptor.getMappingForAttributeName("lastUpdatedOn").setWeight(5);
    }
}
Comment 3 Sergey Petrov 2011-07-10 10:17:00 UTC
thanks, there was no weight support on nb side before, but it may be good to add this support and allow to configure somehow in creation wizards, but it's some enhancement may need to be planned for later. it still may have sense to ask in eclipsleink news group or other eclipselink place also or file an issue as it seems reasonable to use old approach by default.
Comment 4 Martin Balin 2016-07-07 08:53:11 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss