I use Hibernate Annotation to mark some fields to be contained in an index like :
@Index(name = "sn")
@Column(length = 2, nullable = false, updatable = false)
private String srvCode = null;
@Index(name = "sn")
@Column(length = 2, nullable = false, updatable = false)
private String cityCode = null;
@Index(name = "sn")
@Column(length = 2, nullable = false, updatable = false)
private String regionCode = null;
@Index(name = "sn")
@Column(nullable = false, updatable = false)
private long sn = -1;
And I expect the index should be created as the sequence of fields declaration order as : srvCode, cityCode, regionCode, sn.
But the actual sequence (cityCode, regionCode, sn, srvCode) seems sorted by the fields name.
Actually the columns creation sequence in a table also sorted too.
Is that causing by the usage of TreeMap inside of the SchemaExport process ?
What can I do to make the index columns created by the fields declaration order but not sorted ?
[b]Hibernate version:[/b]
Hibernate 3.2.5
Hibernate Annotation 3.3.0 GA
[b]Mapping documents:[/b]
by annotation
[b]Name and version of the database you are using:[/b]
MySQL 5.0.45-22.2
[b]The generated SQL (show_sql=true):[/b]
2008-02-14 16:41:26,755 DEBUG SchemaExport:303 - create table floody_test.Quotation (id varchar(32) not null, verLock integer not null, ..., cityCode varchar(2) not null, regionCode varchar(2) not null, sn bigint not null, srvCode varchar(2) not null, ..., primary key (id))
2008-02-14 16:41:32,296 DEBUG SchemaExport:303 - create index sn on floody_test.Quotation (cityCode, regionCode, sn, srvCode)
|