When I use the JPA Console to "Generate persistence unit DDL" the DDL generates tables with columns that are in alphabetical order by column name, with inherited fields at the top (this is a good thing), alphabetized as a separate group. I would expect - and GREATLY prefer - that the column order match the order which I have defined for the fields in my entity classes with JPA annotations.
Is there a way to change this odd behavior for myself locally? Or is this something that requires a code change to the IDEA implementation? Or is this the result of strangeness in some underlying code that is only invoked by the IDEA Generate DDL function?
Generate DDL/SQL actions call the current persistence provider. Hibernate, EclipseLink, OpenJPA are supported.
Depending on what provider you use there may be ways to configure this behavior.
The point is that generated DDL/SQL statements are exactly the same as the ones issued by the provider in runtime.
Yes, I found that this is simply the Hibernate behavior rising to the surface. So far, I haven't found a way past it, nor do I find very compelling the reasons given by the Hibernate team for the DDL production ordering following the runtime interactive ordering. The latter is coerced into alphabetical order because a Java object's annotation sequence is not determinate across JVMs.
Thanks for the reply. I'll report here if I find a better solution than post-hoc editing of the DDL text.