[hibernate-issues] [Hibernate-JIRA] Created: (ANN-863) (AnnotationBinder) Make alphabetically sort of declared properties optional.

Jan Ritzenhoff (JIRA) noreply at atlassian.com
Tue Sep 1 10:04:15 EDT 2009


(AnnotationBinder) Make alphabetically sort of declared properties optional.
----------------------------------------------------------------------------

                 Key: ANN-863
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-863
             Project: Hibernate Annotations
          Issue Type: Improvement
          Components: binder
    Affects Versions: 3.4.0.GA
            Reporter: Jan Ritzenhoff


In Line 1025 of org.hibernate.cfg.AnnotationBinder the declared properties are alphabetically sorted by default. As a result the columns of the CREATE TABLE statement are also alphabetically sorted even if the class dictates another order.

Example:
@Entity
public class MyClass {
  @Id
  public long id;
  public String b;
  public String a;
...getter-setter....
}

results in a table like:
|    id     |     a      |      b

but I (or an important customer, resp.) would like to have an order as declared in the class (for better manual readability):
|    id     |     b      |      a

Sometimes it is important to have this order - eg if you look on big tables with db-tools and you want to see the most important columns first. (and often scientists do so)

My wish is to implement a property like:
<property name="hibernate.sortDeclaredFields" value="true" />

So the columns 1025 - 129 become optional!

//		Collections.sort( properties, new Comparator<XProperty>() {
//			public int compare(XProperty property1, XProperty property2) {
//				return property1.getName().compareTo( property2.getName() );
//			}
//		} );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list