title: Validate hibernate entity-database mappings in spring boot
body: <p>I have an entity:</p>
  
  <pre><code>@Entity
  @Table(name = "tbl_user")
  public class UserEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Long userId;
  </code></pre>
  
  <p>The database definition file which I roll by hand to a real database or with spring.datasource.initialize=true to in-memory h2 test (take a look at column name):</p>
  
  <pre><code>CREATE TABLE tbl_user (
    uer_id BIGINT PRIMARY KEY AUTO_INCREMENT,
  </code></pre>
  
  <p>And application.properties definition related to db:</p>
  
  <pre><code>spring.datasource.initialize=false
  spring.jpa.hibernate.ddl-auto=validate
  hibernate.hbm2ddl.auto=validate
  spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  spring.datasource.schema=classpath:sql/app-db-definition.sql
  </code></pre>
  
  <p>At startup of spring context (in tests too), I want to validate that entity columns mappings match db columns. How do I have to configure it? </p>