Reputation: 6244
I'm using Hibernate + Spring JPA and Mysql 5.7 as DBMS. I want to use some reserved keywords as column name and for that I eanbled:
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
Some columns have a custom definition like:
@CreatedDate
@Column(updatable = false, columnDefinition = "DATETIME(6)")
private LocalDateTime createdDate;
Unfortunately Hibernate translate this as:
`created_date` `DATETIME(6)`
instead of
`created_date` DATETIME(6)
I opened an issue on Hibernate JIRA (JIRA); I was wondering if there is a workaround to use meanwhile.
Upvotes: 6
Views: 2811
Reputation: 23
i found a solution for u just @Column(name = ""to"") what ever u want repplace instead of to
Upvotes: 1
Reputation: 4072
Update JPA to lastest version: https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.2.11.Final
Upvotes: 0
Reputation: 6244
I found the right solution thanks to Hibernate people:
To avoid that column definition is quoted there is a specific setting:
spring.jpa.properties.hibernate.globally_quoted_identifiers_skip_column_definitions=true
Unfortunately, right now, it works backwards (see this bug): so if you want to skip column definition you have to set it to false.
Upvotes: 8