Set column order in database using Springdata

Asked

Viewed 183 times

-1

I would like to know if it is possible (if it is, how to do) to define the order of the columns in the banco de dados using JPA. I noticed that it creates the column Id first, and then the columns in alphabetical order, as in the image below, but I would like to define the ordering of the column (for example, the column First name first), stating which comes first.

Sample image: inserir a descrição da imagem aqui

1 answer

1


There is no way to order, it always creates in alphabetical order. As the table is managed by Hibernate itself, you wouldn’t have to care about that.

What you could do to get around the situation would be to create the bank in hand or name the columns alphabetically so that they stay in the order you want.

If you choose to create at hand, you can take the creation script of the bank with your DBMS and run it with the columns in the sort you want.

I particularly recommend that you create your bank with separate scripts

  • Thanks for the reply @Gustavo

Browser other questions tagged

You are not signed in. Login or sign up in order to post.