I\'m having trouble with the ordering of the columns in my composite primary key. I have a table that contains the following:
@Embeddable
public class Messa
I really don't think there is a way to do this. All I can do is suggest you use the SQL create statement you have (change it to have the correct order) and run it manually in production.
In tests let Hibernate do its thing.
There is a way to do it. How hibernate chooses to order a set of columns for a primary key is alphabetical by your object names defined.
So for e.g. if you declare your objects like this:
private byte loc;
private long epochtime;
You'll get as you are getting now:
(`epochtime`,`loc`)
But if you rename them for e.g.:
private byte aloc;
private long epochtime;
It would generate it as:
(`aloc`, `epochtime`)
As a comes before e.
That's what I found out when I wanted my clustered index to be in the specific order. I know it is irritating but it's the only way I could find so that I won't have to change my schema manually.