• When using below configuration :
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update

  • Having an entity with a columnDefinition

▶️ Then : the column definition part, in generated DLL, is wrongly coted, getting an exception :

org.hibernate.tool.schema.spi.CommandAcceptanceException: 
Error executing DDL "create table `table_name` (`col_name` `...columnDefinition...` , ... other columns ...

For exemple :

  • application.properties :
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
  • SimpleEntity :
@Entity
@Getter
@Setter
@NoArgsConstructor
public class SimpleEntity {
    @Id
    @GeneratedValue
    private Long id;

    @Column(columnDefinition = "DECIMAL(19,6) null")
    private BigDecimal quantity;
}

Will generate DLL : create table `simple_entity` (`id` bigint not null auto_increment, `quantity` `DECIMAL(19,6) null`)

Expected DLL : ..., `quantity` DECIMAL(19,6) null)

Used environment :

  • Spring boot : 2.5.1

  • MySQL connector : 5.1.36

  • Other properties :

spring.jpa.hibernate.use-new-id-generator-mappings=false
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect

Comment From: Ferhatos

Solved

Sorry, it concern Hibernate. I close the issue. Solved by adding bellow property :

spring.jpa.properties.hibernate.globally_quoted_identifiers_skip_column_definitions=true