Is there any way to control the column order in the generated SQL using the Ant schemaexport task? The columns from each entity appear to be listed in alphabetical order and I would like them to be in the same order as they occur in the annotated entity source file.
Thanks.
--Jim
Hibernate version: Hibernate Annotations 3.2.1.GA; Hibernate Tools 3.2.0.beta9a
Name and version of the database you are using: MySQL 4.1.12
Annotated Java entities:
Code:
@MappedSuperclass
public abstract class PersistentEntity implements Serializable {
@Id @GeneratedValue
@Column(updatable = false, insertable = false)
@org.hibernate.annotations.Generated(org.hibernate.annotations.GenerationTime.INSERT)
private int dbid;
@Column(updatable = false, insertable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp")
@org.hibernate.annotations.Generated(org.hibernate.annotations.GenerationTime.ALWAYS)
private Timestamp dbupdate;
@Column(updatable = false, columnDefinition = "timestamp default 0")
private Timestamp dbentry;
// getters and setters
}
Code:
@Entity
@Table(name = "Reservation.resource")
public class ReservationResource extends PersistentEntity {
@OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "resource")
private Set<Reservation> reservations = new HashSet<Reservation>();
@Column(nullable=false)
private String code;
private String resourceName;
private String resourceType;
private String program;
private String useListName;
private String whoListName;
private String technologyListName;
@Column(length=65535)
private String description;
// getters and setters here
}
The generated SQL (show_sql=true):Code:
create table Reservation.resource (
dbid integer not null auto_increment,
dbentry timestamp default 0,
dbupdate timestamp default current_timestamp on update current_timestamp,
code varchar(255) not null,
description text,
program varchar(255) not null,
resourceName varchar(255),
resourceType varchar(255),
technologyListName varchar(255),
useListName varchar(255),
whoListName varchar(255),
primary key (dbid)
) type=InnoDB;