Wrong ordering in generated table in jpa

Hibernate generates columns in alphabetical order. According to this post the reason is given as:

It is sorted to ensurce deterministic
ordering across clusters.

We can’t rely on the vm to return the
methods in the same order every time
so we had to do something.

Apparently it used to be in the order of occurrence but this changed between 3.2.0 GA and 3.2.1 GA.

I also found Schema auto generation creates columns in alphabetical order for compound primary keys and this seems to be like your problem. This ticket is about the order changing in primary keys and that negatively impacts index performance.

There is no fix for this other than a workaround of naming the columns in such a way that they come out in the correct order (no, I’m not kidding).

Leave a Comment