Controlling column order when creating tables with ddl-generation [message #388115] |
Mon, 25 May 2009 11:33  |
Eclipse User |
|
|
|
I'm using EclipseLink with the "eclipselink.ddl-generation" property set
to "create-tables". The order of the columns in the created tables seems
random. I want the columns in a particular order - the order in which the
fields appear in the Entity class definition.
My database is PostgresQL.
Is there a way to tell EclipseLink to create the columns in the order in
the Entity class definition or some other way to specify column order?
Thanks.
|
|
|
|
Re: Controlling column order when creating tables with ddl-generation [message #735928 is a reply to message #388423] |
Thu, 13 October 2011 02:50   |
Eclipse User |
|
|
|
Hello James,
In my application,I define an entity class and a class implements DescriptorCustomizer,
@Entity
@Table(name = "adapter")
@Customizer(OrderCustomizer.class)
public class AdapterRecord implements Comparable<AdapterRecord>, Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String name;
private int serialNum;
private boolean isRunnig;
private String serverIp;
@Temporal(TemporalType.TIMESTAMP)
private Date startTime;
private int test;
private int test1;
private int ptest;
private String pIp;
private String sIp;
private int aTest;
......
}
public class OrderCustomizer implements DescriptorCustomizer
{
@Override
public void customize(ClassDescriptor descriptor)
{
descriptor.setShouldOrderMappings(false);
}
}
I want the columns in a particular order - the order in which the
fields appear in the Entity class definition.
But when I run the application ,I got columns order :

starttime,
id,
atest,
test1,
test,
name,
serverip,
isrunning,
serialnum,
pIp,
ptest,
sip
Could you give me some help ? Thanks a lot.
Boyd
Attachment: columns.JPG
(Size: 51.96KB, Downloaded 973 times)
[Updated on: Thu, 13 October 2011 02:56] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.70856 seconds