简体   繁体   中英

Spring Boot - Hibernate import.sql column names are converted to upper case

I want to import default entries into my database with the import.sql which gets executed on ddl-auto: create-drop .

INSERT INTO CAR (vehicleId, manufacturer, model, bodyDesign, capacity, capacityUnit, constructionDate, cylinders, doors, fuelType, gears, gearBox, isElectric, ps, seats, propulsion) VALUES ("WBA5J71050GZ75477", "BMW", "M3", "Coupé", 3246, "m³", PARSEDATETIME('17-03-2015', 'dd-MM-yyyy'), 6, 2, "petrol", 6, "semi-automatic", false, 343, 5, "rear");

However the column names i want to insert to are getting converted to upper case automatically:

2017-12-11 15:57:04.668 ERROR 24141 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000388: Unsuccessful: INSERT INTO CAR (vehicleId, manufacturer, model, bodyDesign, capacity, capacityUnit, constructionDate, cylinders, doors, fuelType, gears, gearBox, isElectric, ps, seats, propulsion) VALUES ("WBA5J71050GZ75477", "BMW", "M3", "Coupé", 3246, "m³", PARSEDATETIME('17-03-2015', 'dd-MM-yyyy'), 6, 2, "petrol", 6, "semi-automatic", false, 343, 5, "rear")
2017-12-11 15:57:04.668 ERROR 24141 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : Column "VEHICLEID" not found; SQL statement:

Is there some way to circumvent this issue without renaming all my columns?

Solved by setting spring.jpa.hibernate.naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl in application.yml

server:
  contextPath:

spring:
  jackson:
    serialization:
      INDENT_OUTPUT: true   
  jpa:
    hibernate:
      ddl-auto: create-drop

spring.jpa.properties.hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM