title: How to order columns in Spring Data JPA
body: <p>I have the below class:</p>
  <pre><code>@Table(name = &quot;Code_Master&quot;)
  public class CodeMaster {
  
      @Column(name = &quot;Grade&quot;)
      private String grade;
  
      @Column(name = &quot;Code&quot;)
      private Integer code;
  
      @Column(name = &quot;Code_Name&quot;)
      private String codeName;
  
      @Column(name = &quot;Company&quot;)
      private Integer company;
  
      @Column(name = &quot;Case&quot;)
      private Integer case;
  }
  </code></pre>
  <p>This generates my table in Database with sorted column names, in the order: <br/>
  case <br/>
  code <br/>
  codeName <br/>
  company <br/>
  grade <br/></p>
  <p>However, I do not want this order. I want the column order that is specified in the class.</p>
  <p>I have searched throught, but could not find a way to change the create table query of spring data jpa.</p>
  <p>Resources tried: <br/>
  <a href="https://stackoverflow.com/questions/1298322/wrong-ordering-in-generated-table-in-jpa">Wrong ordering in generated table in jpa</a> <br/>
  <a href="https://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-creating-database-queries-with-the-query-annotation/" rel="nofollow noreferrer">https://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-creating-database-queries-with-the-query-annotation/</a> <br/>
  <a href="https://www.baeldung.com/spring-data-jpa-generate-db-schema" rel="nofollow noreferrer">https://www.baeldung.com/spring-data-jpa-generate-db-schema</a> <br/>
  <a href="https://thorben-janssen.com/create-generate-table-model/" rel="nofollow noreferrer">https://thorben-janssen.com/create-generate-table-model/</a> <br/></p>
  <p>Can someone please help me with this issue?</p>