0

I have an entity:

@Entity
@Table(name = "tbl_user")
public class UserEntity {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "user_id")
  private Long userId;

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):

CREATE TABLE tbl_user (
  uer_id BIGINT PRIMARY KEY AUTO_INCREMENT,

And application.properties definition related to db:

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

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?

1

1 Answer 1

1

I had an overriding version of hibernate in dependencies and misconfiguration to use it, so it skips properties :( M.Denium in the comment also right, that I forgot about spring.jpa.properties.* prefixes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.