您提到:
数据库为空。当我尝试运行SpringMVC应用程序时,它给了我这个错误。
当数据库为空时,预计会出现此错误。当您指定hbm2ddl.auto = create时,将发生以下情况。
--Execute the scripts in this order alter table <TABLE NAME> drop foreign key <ConSTRAINT NAME>; drop table <TABLE NAME> if exists create table <TABLE NAME> alter table <TABLE NAME> add constraint <ConSTRAINT NAME>
当hibernate第一次使用这些设置运行脚本时,由于缺少养分而检测到的错误将作为 警告 记录。DROP脚本不会失败,因为它们具有if存在检查。
在第二次运行时,约束将存在并且
alter table drop constraint语句不会失败。因此,您将不会看到任何错误。



