简体   繁体   English

Spring Boot 2.0 / Hibernate MySql Alter表语法错误

[英]Spring Boot 2.0 / Hibernate MySql Alter table syntax Error

With Spring Boot 2.0, when using property spring.jpa.hibernate.ddl-auto: update , hibernate is generating an incorrect alter table ddl statement. 在Spring Boot 2.0中,当使用属性spring.jpa.hibernate.ddl-auto: update ,hibernate会生成不正确的alter table ddl语句。 Worked fine in Spring Boot 1.5.7. 在Spring Boot 1.5.7中工作正常。 I have tried the various mysql dialects, with no success. 我尝试了各种mysql方言,但没有成功。

Here's an example of the sql that is being generated: 这是正在生成的sql的示例:

alter table testDatabase.analyte_definition add column action_level decimal(8,2)  

The problem is the database name `testDatabase" is be prepended on the alter statement. The correct syntax is: 问题是在alter语句前添加了数据库名称“ testDatabase”,正确的语法是:

alter table analyte_definition add column action_level decimal(8,2)  

Finally found out what was going on here. 终于发现这里发生了什么。 Turns out my local database name had a period in it, ie; 原来我的本地数据库名称中有一个句点,即; local.prod20190319. local.prod20190319。 Changing the db name to local_prod20190319, solved the issue. 将数据库名称更改为local_prod20190319可以解决此问题。 Having the period in the db name worked in SB 1.5.x, but not in SB 2.x. 在db名称中使用句点在SB 1.5.x中有效,但在SB 2.x中无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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